diff options
Diffstat (limited to 'gamemode/nrequire.lua')
| -rw-r--r-- | gamemode/nrequire.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index 5e8d1a6..1ec4fb7 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -137,7 +137,7 @@ end local pathstack = {} -local coroutines = {} +--local coroutines = {} --[[ Returns the table returned by executing a file. The table is cached after is is loaded, so calling nrequire() on a file twice will only run it once. ]] @@ -150,14 +150,14 @@ function nrequire(req) for k,v in pairs(pathstack) do assert(v ~= tpath,string.format("Circular dependancy detected:\n\t%s\n\t\t|\n\t\tV\n\t%s",table.concat(pathstack,"\n\t\t|\n\t\tV\n\t"),v)) 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 --print(string.format("%sIncluding %q",table.concat(tab_rep),tpath)) --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) @@ -170,7 +170,7 @@ function nrequire(req) coroutine.resume(co) ]] pathstack[#pathstack] = nil - + --[[ --Try to resume everyone else waiting on something for k,v in pairs(coroutines) do @@ -178,7 +178,7 @@ function nrequire(req) coroutine.resume(v) end ]] - + --Undo the crazy print --print = oldprint --print(string.format("%sIncluded %q",table.concat(tab_rep),tpath)) |
