From ef4ca568890551dcbaf6b5c9f61fa871df96e4d9 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Thu, 12 May 2022 00:02:25 +1000 Subject: [PATCH] refactor(init): return a stub for imports with no return Modules that define globals or directly add several functions to the lib namespace currently need to return empty functions (i.e. locales). --- init.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 2490bd7..5ebb0b8 100644 --- a/init.lua +++ b/init.lua @@ -47,7 +47,8 @@ local function loadModule(self, module) if err then error(('\n^1Error importing module (%s): %s^0'):format(dir, err), 3) else - rawset(self, module, chunk()) + local result = chunk() or function() end + rawset(self, module, result) return self[module] end end @@ -90,9 +91,6 @@ lib = setmetatable({ }, { __index = call, __call = call, - __newindex = function() - error('Cannot set index on lib') - end, }) local intervals = {}