Skip to content

Instantly share code, notes, and snippets.

@nikcorg
Last active June 22, 2016 09:23
Embed
What would you like to do?
function dump(o, p)
p = p or ''
if type(o) == 'table' then
local s = '{\n'
local pp = p .. ' '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"' .. k .. '"' end
s = s .. pp .. '[' .. k .. '] = ' .. dump(v, pp)
end
return (s .. p .. '}\n')
else
return tostring(o) .. ',\n'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment