请输入您要查询的百科知识:

 

词条 Module:Sandbox/iantresman/sandbox/archive/mw.recursive
释义

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 .. "\*Arguments: " .. prtable(frame.args)

-- result = result .. "\*MW data: " .. prtable(mw.site)

result = result .. "\*Example table: " .. prtable(a)

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 .. "\:" .. k .. ": " .. v

else

result = result .. "\:" .. k .. ": " .. prtable(v, result)

end

end

else

result = result .. tostring(t)

end

return result

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/20 12:35:09