From f02d0d5d37d269ce814ca4a59ddedea7e53fd733 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 14 Oct 2018 20:55:21 +0100 Subject: [PATCH] Global Fixed :D --- FactorioSoftmodManager.lua | 11 ++++++++++- control.lua | 8 ++++---- modules/ExpGamingCore/Role/control.lua | 1 - 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/FactorioSoftmodManager.lua b/FactorioSoftmodManager.lua index 7e003853..d539699b 100644 --- a/FactorioSoftmodManager.lua +++ b/FactorioSoftmodManager.lua @@ -196,7 +196,16 @@ Manager.global=setmetatable({__defaults={},__global={ end return setmetatable(Global,{ __call=function(tbl,default) return Manager.global(default,tbl) end, - __index=function(tbl,key) return rawget(Manager.global(),key) or moduleIndex[key] and Manager.global(key) end, + __index=function(tbl,key) return rawget(Manager.global(nil,tbl),key) or moduleIndex[key] and Manager.global(key) end, + __newindex=function(tbl,key,value) rawset(Manager.global(nil,tbl),key,value) end, + __pairs=function(tbl) + local tbl = Manager.global(nil,tbl) + local function next_pair(tbl,k) + k, v = next(tbl, k) + if type(v) ~= nil then return k,v end + end + return next_pair, tbl, nil + end, path=module_path,name=module_name }) end, diff --git a/control.lua b/control.lua index 332fb4e3..1c352a55 100644 --- a/control.lua +++ b/control.lua @@ -3,10 +3,10 @@ function _log(...) log(...) end -- do not remove this is used for smaller verbos Manager = require("FactorioSoftmodManager") Manager.setVerbose{ selfInit=true, -- called while the manager is being set up - moduleLoad=true, -- when a module is required by the manager - moduleInit=true, -- when and within the initation of a module - modulePost=true, -- when and within the post of a module - moduleEnv=true, -- during module runtime, this is a global option set within each module for fine control + moduleLoad=false, -- when a module is required by the manager + moduleInit=false, -- when and within the initation of a module + modulePost=false, -- when and within the post of a module + moduleEnv=false, -- during module runtime, this is a global option set within each module for fine control eventRegistered=false, -- when a module registers its event handlers errorCaught=true, -- when an error is caught during runtime output=Manager._verbose -- can be: can be: print || log || other function diff --git a/modules/ExpGamingCore/Role/control.lua b/modules/ExpGamingCore/Role/control.lua index fe48673c..97bb1cb1 100644 --- a/modules/ExpGamingCore/Role/control.lua +++ b/modules/ExpGamingCore/Role/control.lua @@ -326,7 +326,6 @@ end function Role._prototype:get_players(online) if not self_test(self,'role','get_players') then return end if online and not type_error(online,'boolean','Invalid argument #1 to role:get_players, online is not a boolean.') then return end - log(serpent.line(global)) if not global.roles[self.name] then global.roles[self.name] = {} end local rtn = {} for _,player_index in pairs(global.roles[self.name]) do