Content deleted Content added
|
|
foo = 'Result of tested Lua snippet would be here.'
bar = mw.loadData('Module:Sandbox/Nihiltres/Import')
returnVal = foo
foo = bar.text
if type(returnVal) == 'table' then
return mw.dumpObject(foo)
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
|