p = {}
function p.main (frame)
foo = 'Result of tested Lua snippet would be here.'
returnVal = foo
if type(returnVal) == 'table' then
function tableRender (tbl, level)
level = level or 0
--maxLevel avoids recursive issues; adjust as needed
maxLevel = 4
if level > maxLevel then return tostring(tbl) end
tab = ''
for i = 1, (level * 4) do tab = tab .. " " end
local text = ''
for k,v in pairs(tbl) do
if v == tbl then return tostring(tbl) end
text = text..'\n\n'..tab..k..":"
if type(v) == 'table' then
text = text .. tableRender(tbl, level + 1)
else
text = text..v
end
end
return text
end
return tableRender(returnVal)
else
return tostring(returnVal)
end
end
return p