diff --git a/util.lua b/util.lua index a850a17..a2fe705 100644 --- a/util.lua +++ b/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