Skip to content

Instantly share code, notes, and snippets.

@Shujito Shujito/recurse.lua
Created Mar 2, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.