utils.lua 273 B

1234567891011121314
  1. -- dump a table to a string
  2. function dump(o)
  3. if type(o) == 'table' then
  4. local s = '{ '
  5. for k,v in pairs(o) do
  6. if type(k) ~= 'number' then k = '"'..k..'"' end
  7. s = s .. '['..k..'] = ' .. dump(v) .. ','
  8. end
  9. return s .. '} '
  10. else
  11. return tostring(o)
  12. end
  13. end