system_load(3)
π 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 β¨
- 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.
- The namespace mapping can be changed compile-time by setting
CAREFUL_USERMASKandMODULE_USERMASKfor thearcan_lua.csource 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
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms