Module:Sandbox/Ahecht
Appearance
{{Module rating }}
Usage
[edit]{{#invoke:Sandbox/Ahecht|main}}
Output
[edit]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
See also
[edit]- Sandbox/Ahecht
- Sandbox/Ahecht/Catalog lookup link
- Sandbox/Ahecht/Cite DNV
- Sandbox/Ahecht/Gridiron color
- Sandbox/Ahecht/Xviews
- Sandbox/Ahecht/bartable
- Sandbox/Ahecht/bartable/doc
- Sandbox/Ahecht/benchmark
- Sandbox/Ahecht/cite
- Sandbox/Ahecht/coords
- Sandbox/Ahecht/doc
- Sandbox/Ahecht/expand
- Sandbox/Ahecht/flag
- Sandbox/Ahecht/flag/doc
- Sandbox/Ahecht/flag/redirects
- Sandbox/Ahecht/flag/redirects/doc
- Sandbox/Ahecht/interwiki
- Sandbox/Ahecht/interwiki/doc
- Sandbox/Ahecht/min
- Sandbox/Ahecht/modsandbox
- Sandbox/Ahecht/navboxtolua
- Sandbox/Ahecht/navboxtolua/doc
- Sandbox/Ahecht/r
- Sandbox/Ahecht/sandbox
- Sandbox/Ahecht/sandbox2
- Sandbox/Ahecht/sandbox2/doc
- Sandbox/Ahecht/test2
- Sandbox/Ahecht/trim date
- Sandbox/Ahecht/url-access
- Sandbox/Ahecht/wikibase
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
})