Fixed lua ENV stuff and non saving globals

This commit is contained in:
Cooldude2606
2018-06-22 19:48:18 +01:00
parent 251249dcdc
commit 1d132b92fb
10 changed files with 16 additions and 8 deletions

View File

@@ -27,11 +27,11 @@ Gui.data = setmetatable({},{
end
})
Gui.center = require(module_path..'/src/center')
Gui.inputs = require(module_path..'/src/inputs')
Gui.left = require(module_path..'/src/left')
Gui.popup = require(module_path..'/src/popup')
Gui.toolbar = require(module_path..'/src/toolbar')
Gui.center = require(module_path..'/src/center',{Gui=Gui})
Gui.inputs = require(module_path..'/src/inputs',{Gui=Gui})
Gui.left = require(module_path..'/src/left',{Gui=Gui})
Gui.popup = require(module_path..'/src/popup',{Gui=Gui})
Gui.toolbar = require(module_path..'/src/toolbar',{Gui=Gui})
--- Add a white bar to any gui frame
-- @usage Gui.bar(frame,100)
@@ -157,7 +157,7 @@ script.on_event('on_player_respawned',function(event)
end)
function Gui:on_init()
if loaded_modules['ExpGamingCore.Server'] then verbose('ExpGamingCore.Server is installed; Loading server src') require(module_path..'/src/server') end
if loaded_modules['ExpGamingCore.Server'] then verbose('ExpGamingCore.Server is installed; Loading server src') require(module_path..'/src/server',{Gui=Gui}) end
if loaded_modules['ExpGamingCore.Ranking'] then
verbose('ExpGamingCore.Ranking is installed; Loading ranking src')
script.on_event('on_rank_change',function(event)
@@ -173,7 +173,7 @@ function Gui:on_init()
end
function Gui:on_post()
Gui.test = require(module_path..'/src/test')
Gui.test = require(module_path..'/src/test',{Gui=Gui})
Gui.popup.load() Gui.popup.load = nil
end

View File

@@ -10,6 +10,7 @@
local Game = require('FactorioStdLib.Game')
local Color = require('FactorioStdLib.Color')
local mod_gui = require("mod-gui")
local Gui = Gui -- this is to force gui to remain in the ENV
local center = {}
center._center = {}

View File

@@ -10,6 +10,7 @@
local Game = require('FactorioStdLib.Game')
local Color = require('FactorioStdLib.Color')
local mod_gui = require("mod-gui")
local Gui = Gui -- this is to force gui to remain in the ENV
local inputs = {}
inputs._input = {}

View File

@@ -12,6 +12,7 @@ local Color = require('FactorioStdLib.Color')
local success, Ranking = pcall(require,'ExpGamingCore.Ranking')
if not success then Ranking = nil end success = nil
local mod_gui = require("mod-gui")
local Gui = Gui -- this is to force gui to remain in the ENV
local left = {}
left._left = {}

View File

@@ -9,6 +9,7 @@
local Game = require('FactorioStdLib.Game')
local mod_gui = require("mod-gui")
local Gui = Gui -- this is to force gui to remain in the ENV
local popup = {}
popup._popup = {}

View File

@@ -9,6 +9,7 @@
local Game = require('FactorioStdLib.Game')
local Server = require('ExpGamingCore.Server')
local Gui = Gui -- this is to force gui to remain in the ENV
--- Adds a server thread that allows the camera follows to be toggled off and on
-- @function __comment

View File

@@ -6,7 +6,7 @@
--- This is a submodule of ExpGamingCore.Gui but for ldoc reasons it is under its own module
-- @function _comment
local Gui = require('ExpGamingCore.Gui')
local Gui = Gui -- this is to force gui to remain in the ENV
local mod_gui = require("mod-gui")
local gui_tset_close = Gui.inputs.add{

View File

@@ -11,6 +11,7 @@ local Game = require('FactorioStdLib.Game')
local success, Ranking = pcall(require,'ExpGamingCore.Ranking')
if not success then Ranking = nil end success = nil
local mod_gui = require("mod-gui")
local Gui = Gui -- this is to force gui to remain in the ENV
local toolbar = {}

View File

@@ -143,6 +143,7 @@ end
-- @function errorHandler
-- @tparam string err the error passed by the err control
error.addHandler('Discord Emit',function(err)
if not game then return error(error()) end
local color = Color and Color.to_hex(defines.textcolor.bg) or '0x0'
Sync.emit_embeded{title='SCRIPT ERROR',color=color,description='There was an error in the script @Developers ',Error=err}
end)

View File

@@ -9,6 +9,7 @@
local Game = require('FactorioStdLib.Game')
local Gui = require('ExpGamingCore.Gui')
local Sync = Sync -- this is to force sync to remain in the ENV
local Sync_gui_functions = {}