sci4me

printTable

Mar 25th, 2016
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. local function printTable(t)
  2.     local result = {}
  3.    
  4.     table.insert(result, "{ ")
  5.     for i = 1, #t do
  6.         local j = t[i]
  7.         if type(j) == "table" then
  8.             table.insert(result, printTable(j))
  9.         else
  10.             table.insert(result, j)
  11.         end
  12.  
  13.         if i < #t then
  14.             table.insert(result, ", ")
  15.         end        
  16.     end
  17.     table.insert(result, " }")
  18.    
  19.     return table.concat(result)
  20. end
Add Comment
Please, Sign In to add comment