You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JabDoesThings edited this page Nov 17, 2024
·
3 revisions
-- Import the library as a module.localModLoader=require'asledgehammer/modloader/ModLoader';
-- (To keep all prints clean and contextual)localinfo=function(msg)
print('[' ..module..'] :: ' ..msg);
end--- @parammodulestring The module folder.--- @parampathstring The path in the module to the file.--- @paramresult 0 | 1 -ModLoader.RESULT_FILE_NOT_FOUND-ModLoader.RESULT_SUCCESS--- @paramdatastring | nil The data retrieved from the server.localcallback=function(module, path, result, data)
-- Handle non-installed / missing result.ifresult==ModLoader.RESULT_FILE_NOT_FOUNDtheninfo('File not installed on server. Ignoring..');
return;
end-- Handle data here. (Example is Lua code)loadstring(data)();
end;
--- @typeboolean------ If true, the server will cache the file so when--- called again it'll be ready.localcache=true;
-- Request the file:-- ~/Zomboid/Lua/ModLoader/mods/FoobarExample/Foobar_Client.luaModLoader:requestServerFile('FoobarExample', 'Foobar_Client.lua', cache, callback);