aboutsummaryrefslogtreecommitdiff
path: root/gamemode/nrequire.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-06-19 00:07:01 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-06-19 00:07:01 -0400
commit461a29d8fdb2fd6c86a77912e9c2232e1f101ca8 (patch)
treeed76c1a1abf64369ee36b88533e78a8a94566631 /gamemode/nrequire.lua
parent0ae33ad32868af226fba6d887320aa87aa19d3a4 (diff)
downloadartery-461a29d8fdb2fd6c86a77912e9c2232e1f101ca8.tar.gz
artery-461a29d8fdb2fd6c86a77912e9c2232e1f101ca8.tar.bz2
artery-461a29d8fdb2fd6c86a77912e9c2232e1f101ca8.zip
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.
Diffstat (limited to 'gamemode/nrequire.lua')
-rw-r--r--gamemode/nrequire.lua15
1 files changed, 10 insertions, 5 deletions
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