Clean up persistence.lua

This commit is contained in:
Lars Mueller 2022-02-27 17:41:25 +01:00
parent 2c5e2e1e5c
commit 69510b1965

@ -3,10 +3,10 @@ local require = ... or require
local function load(module_name)
return assert(loadfile(modlib.mod.get_resource(modlib.modname, "persistence", module_name .. ".lua")))
end
local _ENV = setmetatable({}, {__index = function(_ENV, module_name)
return setmetatable({}, {__index = function(self, module_name)
if module_name == "lua_log_file" then
local module = load(module_name)()
_ENV[module_name] = module
self[module_name] = module
return module
end
if module_name == "sqlite3" then
@ -17,8 +17,7 @@ local _ENV = setmetatable({}, {__index = function(_ENV, module_name)
end
return func(require"lsqlite3")
end
_ENV[module_name] = module
self[module_name] = module
return module
end
end})
return _ENV
end})