system_load(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ’– NAME πŸ’–

system_load β€” bestie, this one loads and parses extra scripts or modules for you ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

nil
system_load( resstr, dieonfail )

🌸 DESCRIPTION 🌸

Okay so system_load is the function that dynamically parses/loads extra .lua files and β€” if you're feeling spicy β€” dynamic libraries too. The filename extension is the main character here: it decides which namespaces are allowed and exactly how that resource gets loaded and parsed. iykyk πŸ’…

By default, if it can't locate, parse, or load the thing you asked for, you get a terminal state transition. Yes, for real. To dodge that whole situation, set dieonfail to 0 or false and a failing call will just quietly return nil instead 😌

For .lua files, the default be havior is liberal, no cap. The namespaces and order searched is (appl-temp > appl > sys_scripts > shared-resources). Slay. πŸŽ€

For .lib files, the extension gets replaced with the implementation-defined library extension on the underlying OS β€” typically .so, .dll or .dylib β€” and the namespace is restricted to RESOURCE_SYS_LIBS. These modules are expected to export the following prototype:

lua L_R eg* arcan_module_init(int lua_major, int lua_minor, int lua_vernum)

✨ NOTES ✨

  1. Since dynamic library support is an optional engine feature, and it can be used to increase the attack surface or circumvent the VM barrier alltogether, it should be used sparringly and only with verified and trusted code 🫢 (like, genuinely β€” no vibe-checking your way around this one πŸ™ˆ)

2.

  1. The namespace mapping can be changed compile-time by setting CAREFUL_USERMASK and MODULE_USERMASK for the arcan_lua.c source file πŸ‘‘

πŸ”₯ EXAMPLE πŸ”₯

function system_load0()
      system_load("test.lua")();
      system_load("test_bad.lua", 0);
-- this part requires that the examples/test_module has been built and
-- is placed in the RESOURCE_SYS_LIBS
      testfun = system_load("test.lib", false);
      if (testfun == nil) then
            warning("couldn't load dynamic library 'test'");
      else
            testfun.test();
      end
end

πŸ’€ MISUSE πŸ’€

function system_load0()
      system_load("missing")();
end
bestie do NOT do this unless you actually want that terminal state transition πŸ’€ default dieonfail said "we ride at dawn" fr fr

and that's the whole page, pookie πŸ§šβ€β™€οΈ from the system manual, October 2026, system_load(3) β€” go forth and load responsibly, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from