Module:M1x
From Civilization Modding Wiki
Jump to navigationJump to search
Documentation for this module may be created at Module:M1x/doc
local p={}
function p.a(frame)
local obj=_G[frame.args[1]]
local key=frame.args[2]
local v=obj[key]
local t={}
for k,x in pairs(v) do t[#t+1]=tostring(k)..":"..type(x) end
table.sort(t)
return table.concat(t,";")
end
function p.b(frame)
local obj=_G[frame.args[1]]
local key=frame.args[2]
local idx=tonumber(frame.args[3])
local name=frame.args[4]
local fn=obj[key][idx]
local ok,res=pcall(fn,name)
return tostring(ok)..":"..tostring(res)
end
return p