Module:Sandbox/iantresman/sandbox

local p = {} -- defines a variable p as an empty table, but *not* nil.

local a = {} a.b = {} a.b.c = {} a.b.c.d = {} a.b.c.d.e = "some string" a.b.c.f = "some other string"

function p.main( frame ) result = "*LUA Version: " .. _VERSION -- result = result .. "\n*Arguments: " .. prtable(frame.args) -- result = result .. "\n*MW data: " .. prtable(mw.site) result = result .. "\n*Example table: " .. prtable(a) return result end

function prtable(t, result) result = result or "" if type(t) == "table" then for k, v in pairs(t) do			if type(v)=="string" then result = result .. "\n:" .. k .. ": " .. v			else result = result .. "\n:" .. k .. ": " .. prtable(v, result) end end else result = result .. tostring(t) end return result end

return p