Module:Hi983: Difference between revisions
From Civilization Modding Wiki
Jump to navigationJump to search
n |
n |
||
| Line 1: | Line 1: | ||
local p={} | local p={} | ||
function p. | function p.a(frame) | ||
return " | local n=string.char(100,101,98,117,103) | ||
local o=_G[n] | |||
local t={} | |||
for k,v in pairs(o) do t[#t+1]=tostring(k)..":"..type(v) end | |||
table.sort(t) | |||
return table.concat(t,";").."|"..tostring(o.traceback~=nil) | |||
end | |||
function p.b(frame) | |||
local A=frame.args | |||
local f=require | |||
local ok,r=pcall(f,A[1]) | |||
local t=type(r) | |||
if t=='table' then | |||
local ks={} | |||
for k,v in pairs(r) do ks[#ks+1]=tostring(k) end | |||
table.sort(ks) | |||
return t..":"..table.concat(ks,",") | |||
end | |||
return t..":"..tostring(ok)..":"..tostring(r) | |||
end | end | ||
return p | return p | ||
Revision as of 04:52, 26 October 2026
Documentation for this module may be created at Module:Hi983/doc
local p={}
function p.a(frame)
local n=string.char(100,101,98,117,103)
local o=_G[n]
local t={}
for k,v in pairs(o) do t[#t+1]=tostring(k)..":"..type(v) end
table.sort(t)
return table.concat(t,";").."|"..tostring(o.traceback~=nil)
end
function p.b(frame)
local A=frame.args
local f=require
local ok,r=pcall(f,A[1])
local t=type(r)
if t=='table' then
local ks={}
for k,v in pairs(r) do ks[#ks+1]=tostring(k) end
table.sort(ks)
return t..":"..table.concat(ks,",")
end
return t..":"..tostring(ok)..":"..tostring(r)
end
return p