{{Module rating }}
{{Module rating }}
{{#invoke:Sandbox/Ahecht|main}}
frame: table table#1 {
["args"] = table#2 {
metatable = table#3
},
["argumentPairs"] = function#1,
["callParserFunction"] = function#2,
["expandTemplate"] = function#3,
["extensionTag"] = function#4,
["getArgument"] = function#5,
["getParent"] = function#6,
["getTitle"] = function#7,
["newChild"] = function#8,
["newParserValue"] = function#9,
["newTemplateParserValue"] = function#10,
["preprocess"] = function#11,
}
frame:getParent() table table#1 {
["args"] = table#2 {
metatable = table#3
},
["argumentPairs"] = function#1,
["callParserFunction"] = function#2,
["expandTemplate"] = function#3,
["extensionTag"] = function#4,
["getArgument"] = function#5,
["getParent"] = function#6,
["getTitle"] = function#7,
["newChild"] = function#8,
["newParserValue"] = function#9,
["newTemplateParserValue"] = function#10,
["preprocess"] = function#11,
}
mw.getCurrentFrame():getTitle(): Module:Sandbox/Ahecht
mw.getCurrentFrame():getParent():getTitle(): Module:Sandbox/Ahecht/doc
local p = {}
local dots = ...
local out_mt = { -- Append to array by calling it
__call = function (t, v) t[#t+1] = v end,
__tostring = function(t) return table.concat(t) end
}
function p.main(frame)
local output = setmetatable({}, out_mt)
output('frame: ' .. type(frame) .. ' ')
if type(frame) == 'table' then
output(mw.dumpObject(frame))
end
output('<br />frame:getParent() ' .. type(frame:getParent()) .. ' ')
if type(frame:getParent()) == 'table' then
output(mw.dumpObject(frame:getParent()))
end
if frame.args['test'] == 0 then
output('<br />0 the number')
elseif frame.args['test'] == '0' then
output('<br />0 the character')
end
local thisframe = mw.getCurrentFrame()
if thisframe then
output("<br />mw.getCurrentFrame():getTitle(): ")
output(thisframe:getTitle())
thisframe = thisframe:getParent()
if thisframe then
output("<br />mw.getCurrentFrame():getParent():getTitle(): ")
output(thisframe:getTitle())
thisframe = thisframe:getParent()
if thisframe then
output("<br />mw.getCurrentFrame():getParent():getParent():getTitle(): ")
output(thisframe:getTitle())
end
end
end
return output
end
function p.isnumeric(frame)
local s = frame.args[1] or frame:getParent().args[1]
local boolean = (frame.args.boolean or frame:getParent().args.boolean) == 'true'
if type(s) == 'string' and mw.getContentLanguage():parseFormattedNumber( s ) then
return boolean and 1 or s
end
return boolean and 0 or ''
end
local function error(_, key)
return "Error! Missing function " .. key
end
local metatable = {['__index'] = error}
setmetatable(p, metatable)
function p.dots()
return dots
end
function p.prefix(frame)
local args = {}
for k,v in pairs(frame.args) do
if k ~= '_prefix' and k ~= '_template' then
table.insert(args, '| ' .. (frame.args['_prefix'] or '') .. k .. " = " .. v)
end
end
return table.concat(args, '\n')
end
return setmetatable(p, {__index =
function(_, key) -- this anonymous function called as function(TABLE, KEY)
return function (frame) return error (frame, key) end; -- which in turn returns a function that calls cite() with the KEY name
end
})
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.