From 9b80e8d8fe2dfa562560f006fb250e6ba8c9aef8 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 29 May 2018 22:15:22 +0100 Subject: [PATCH] Fixed index bug for _G modules --- FactorioSoftmodManager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FactorioSoftmodManager.lua b/FactorioSoftmodManager.lua index c3660234..4daef9f1 100644 --- a/FactorioSoftmodManager.lua +++ b/FactorioSoftmodManager.lua @@ -217,7 +217,7 @@ Manager.loadModules = setmetatable({}, else for key,value in pairs(table.remove(module,1)) do tbl[module_name][key] = value end end end -- if there is a module by this name in _G ex table then it will be indexed to the new module - if rawget(_G,module_name) then setmetatable(rawget(_G,module_name),{__index=tbl[module_name]}) end + if rawget(_G,module_name) and type(tbl[module_name]) == 'table' then setmetatable(rawget(_G,module_name),{__index=tbl[module_name]}) end else Manager.verbose('Failed load: "'..module_name..'"; Location: '..location..' ('..module..')','errorCaught') end