Advertisement
Ultroman

Printing lists in LUA

May 5th, 2019
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.31 KB | None | 0 0
  1. -- For debugging tables.
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement