Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. function printTable(t, indent)
  2. if not indent then
  3. indent = ""
  4. world.logInfo("Printing table...")
  5. end
  6. local tnames = {}
  7. for k,v in pairs(t) do
  8. tnames[#tnames + 1] = k
  9. end
  10. table.sort(tnames, function(a, b) return a < b end)
  11. for _, key in ipairs(tnames) do
  12. if type(t[key]) == "table" then
  13. world.logInfo(indent.."table "..key)
  14. printTable(t[key], indent.." ")
  15. elseif type(t[key]) == "function" then
  16. world.logInfo(indent.."function "..key)
  17. else
  18. world.logInfo(indent..type(t[key]).." "..key.." = %s", t[key])
  19. end
  20. end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement