lua how to print table code example
Example 1: lua print contents of table
for k,v in pairs(table) do
print(v)
end
Example 2: lua dump table
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end