Posted By

pauloiam on 06/28/10


Tagged

table print dump lua


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Dump table


 / Published in: Lua
 

  1. function dump(table, indent)
  2. local indent = indent or ''
  3. for key, value in pairs(table) do
  4. io.write(indent, '[', tostring(key), ']')
  5. if type(value) == "table" then
  6. io.write(':\n') dump(value, indent .. '\t')
  7. else
  8. io.write(' = ', tostring(value), '\n')
  9. end
  10. end
  11. end

Report this snippet  

You need to login to post a comment.