local loadedModules = {}
local function loadModule(name, unload)
if (unload) then
loadedModules[name] = nil
end
if loadedModules[name] then
return loadedModules[name]
end
local fileName = name .. '.lua'
local moduleContent, err = loadfile(fileName)
if (err) then
error(string.format("error loading module: %s\r\n%s", name, err), 2);
end
loadedModules[name] = moduleContent() or true
return loadedModules[name]
end
return loadModule83800cookie-checkLua load module from file