Skip to content

Instantly share code, notes, and snippets.

@Shujito
Created March 2, 2016 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shujito/e8f6947057ad3f87a2ba to your computer and use it in GitHub Desktop.
Save Shujito/e8f6947057ad3f87a2ba to your computer and use it in GitHub Desktop.
Recurse a lua table
local function recurse(t,lvl)
lvl = lvl or 0
for k,v in pairs(t) do
print( string.rep(' ',lvl) .. k)
if type(v) == 'table' then
recurse(v,lvl+1)
else
print( string.rep(' ',lvl) .. ' ' .. type(v) .. ':')
print( string.rep(' ',lvl) .. ' ' .. tostring(v))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment