Skip to content

Instantly share code, notes, and snippets.

@wilhelmy
Created April 9, 2020 14:28
Show Gist options
  • Save wilhelmy/07ef81bea6d1a8f78bfa1c6d0cf34e9f to your computer and use it in GitHub Desktop.
Save wilhelmy/07ef81bea6d1a8f78bfa1c6d0cf34e9f to your computer and use it in GitHub Desktop.
-- 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