diff --git a/persistence.lua b/persistence.lua index 8940ba7..e57ebaf 100644 --- a/persistence.lua +++ b/persistence.lua @@ -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 \ No newline at end of file +end}) \ No newline at end of file