add dump() to utils
This commit is contained in:
parent
e876def36f
commit
52cc1beb7d
|
@ -79,6 +79,19 @@ local function firstAlphaNum(s)
|
|||
return '';
|
||||
end
|
||||
|
||||
local 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
|
||||
|
||||
return {
|
||||
split = split,
|
||||
filter = filter,
|
||||
|
@ -91,4 +104,5 @@ return {
|
|||
mix = mix,
|
||||
modIndex = modIndex,
|
||||
firstAlphaNum = firstAlphaNum,
|
||||
dump = dump
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue