diff options
Diffstat (limited to 'gamemode/core')
| -rw-r--r-- | gamemode/core/dataloader/cl_loadglobals.lua | 21 | ||||
| -rw-r--r-- | gamemode/core/inventory/cl_invtracker.lua | 1 |
2 files changed, 14 insertions, 8 deletions
diff --git a/gamemode/core/dataloader/cl_loadglobals.lua b/gamemode/core/dataloader/cl_loadglobals.lua index d286f36..c4837c8 100644 --- a/gamemode/core/dataloader/cl_loadglobals.lua +++ b/gamemode/core/dataloader/cl_loadglobals.lua @@ -1,4 +1,15 @@ local log = nrequire("log.lua") + +local function run_csfile(txt,name) + assert(#txt > 0, "File was size 0 on: " .. name) + local ptr = CompileString(txt,name,false) + if type(ptr) == "function" then + ptr() + else + log.error(ptr) + end +end + net.Receive("artery_respondfile",function() local filename = net.ReadString() local filetext = net.ReadString() @@ -6,7 +17,7 @@ net.Receive("artery_respondfile",function() file.CreateDir("artery/client/files/" .. dirname) assert(#filetext > 0, "Retreived a size 0 file: " .. filename) file.Write("artery/client/files/" .. filename,filetext) - CompileString(filetext,filename)() + run_csfile(filetext,filename) end) net.Receive("artery_loadfile",function() @@ -26,12 +37,6 @@ net.Receive("artery_loadfile",function() net.WriteString(filename) net.SendToServer() else - assert(#cache > 0, "File was size 0 on: " .. filename) - local err = CompileString(cache,filename,false) - if type(err) == "function" then - err() - else - log.error(err) - end + run_csfile(cache,filename) end end) diff --git a/gamemode/core/inventory/cl_invtracker.lua b/gamemode/core/inventory/cl_invtracker.lua index 14cbfbe..fdf5be3 100644 --- a/gamemode/core/inventory/cl_invtracker.lua +++ b/gamemode/core/inventory/cl_invtracker.lua @@ -3,6 +3,7 @@ ]] local inv = nrequire("inventory/inventory.lua") local itm = nrequire("item.lua") +nrequire("cl_loadglobals.lua") --local state = nrequire("cl_state.lua") local q = {} |
