Added a function to dump tables for easier debug
This commit is contained in:
parent
a330a73986
commit
99c7cdc387
13
util.lua
13
util.lua
@ -1 +1,14 @@
|
||||
function join_tables(t1, t2) for k,v in ipairs(t2) do table.insert(t1, v) end return t1 end
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user