Skip to content

Instantly share code, notes, and snippets.

@Dreezn
Last active February 27, 2018 19:05
Show Gist options
  • Save Dreezn/2fa66703c5d42e22ce7ce2e78aa7bf87 to your computer and use it in GitHub Desktop.
Save Dreezn/2fa66703c5d42e22ce7ce2e78aa7bf87 to your computer and use it in GitHub Desktop.
PrintHMembers for Pico8
function printhmembers(o, indent)
if type(o) == "table" then
if indent==nil then
printh("{")
printhmembers(o,0)
printh("}")
else
local padding=""
for i=0,indent do
padding=padding.." "
end
local itemnb=0
for key,value in pairs(o) do
itemnb+=1
if (type(value)=="table") then
printh(padding..key..":{")
printhmembers(value, indent+1)
printh(padding.."}")
else
local output=tostr(value)
if (type(value)=="string") output="\""..output.."\""
printh(padding..key..":"..tostr(value))
end
end
end
else
printh("printhmembers error: not a table")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment