Created
April 9, 2020 14:28
-
-
Save wilhelmy/07ef81bea6d1a8f78bfa1c6d0cf34e9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- helper functions for repl'ing around | |
-- | |
-- | |
local repl=_G.repl or {} | |
local function print_tree(tab) | |
local indent="" | |
local text="" | |
local i=#tab | |
while i>0 do | |
text=text..indent.."+ "..tostring(tab[i]).."\n" | |
indent=indent.." " | |
i=i-1 | |
end | |
print(text) | |
end | |
function repl.inspect_object(obj) | |
local chain={} | |
while obj do | |
table.insert(chain, obj) | |
obj=obj:manager() | |
end | |
print_tree(chain) | |
end | |
function repl.inspect_table(tab) | |
for k,v in pairs(tab) do | |
print(k,v) | |
end | |
end | |
_G.repl=repl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment