From 461a29d8fdb2fd6c86a77912e9c2232e1f101ca8 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 19 Jun 2017 00:07:01 -0400 Subject: Massive updates Lots of stuff was updated, mostly to support addons. Inventory tracking is also updated a little and a bug fixed in inventory. Nrequire now probably won't crash the client, no matter how many times it's used. --- gamemode/nrequire.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gamemode/nrequire.lua') diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index f25cbb7..14c2248 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -152,30 +152,35 @@ function nrequire(req) end --Override print so it's easy to see what file is printing what - local tab_rep = {} - for k = 1, #pathstack do tab_rep[k] = "\t" end + --local tab_rep = {} + --for k = 1, #pathstack do tab_rep[k] = "\t" end --print(string.format("%sIncluding %q",table.concat(tab_rep),tpath)) - local oldprint = print - print = function(...) oldprint(" ",unpack({...})) end + --local oldprint = print + --print = function(...) oldprint(" ",unpack({...})) end --Deal with bookkeeping dealing with circular dependancies, and include pathstack[#pathstack + 1] = tpath + reqtbl[tpath] = include(tpath) + --[[ co = coroutine.create(function() reqtbl[tpath] = include(tpath) --print("Finished ", tpath) end) coroutines[#coroutines + 1] = co coroutine.resume(co) + ]] pathstack[#pathstack] = nil + --[[ --Try to resume everyone else waiting on something for k,v in pairs(coroutines) do --V will be nil when the coroutine finishes, which removes it from the list, nifty. coroutine.resume(v) end + ]] --Undo the crazy print - print = oldprint + --print = oldprint --print(string.format("%sIncluded %q",table.concat(tab_rep),tpath)) return reqtbl[tpath] end -- cgit v1.2.3-70-g09d2