Profile
- Name
- Dump Table
- ID
- 104731
- Shared with
- Public
- Parent
- None
- Children
- None
- Created on
- April 09, 2021 at 14:48 PM UTC
- Updated on
- April 09, 2021 at 14:48 PM UTC
- Description
A quick and dirty helper function to print a table to console. Source from Matt on StackOverflow. YMMV.
Best for
Code
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