Skip to content

Instantly share code, notes, and snippets.

@nikcorg
Last active June 22, 2016 09:23
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 nikcorg/4185152ea5cca05dc81d7c1ccb748c60 to your computer and use it in GitHub Desktop.
Save nikcorg/4185152ea5cca05dc81d7c1ccb748c60 to your computer and use it in GitHub Desktop.
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