From 69510b1965439a6c52d0f7b9f086ee6cb83d6518 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sun, 27 Feb 2022 17:41:25 +0100 Subject: [PATCH] Clean up persistence.lua --- persistence.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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