mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-21 14:53:44 +01:00
Clean up persistence.lua
This commit is contained in:
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})
|
Loading…
Reference in New Issue
Block a user