Module:Sandbox/BrandonXLF/1
< Module:Sandbox | BrandonXLF
Jump to navigation
Jump to search
Revision as of 23:19, 4 January 2020 by blackwiki>BrandonXLF (Restored revision 883984777 by BrandonXLF (Restorer))
DO NOT DELETE
Module:Call calls a template while giving it all the arguments the current page receives. It is meant to be used in the template namespace and will only work in other namespaces if the page it's being used on is transcluded on another page.
Usage
There are two ways of using the module, using the default function and using the force function.
Set default values for parameters
{{#invoke:call|default|_=template}}
When using the default function, parameters supplied to the #invoke call will be overridden by parameters sent to the template calling this module.
Set forced values for parameters
{{#invoke:call|force|_=template}}
When using the force function, parameters supplied to the #invoke call will override parameters sent to the template calling this module.
local p = {}
function p.main (frame)
local fA = frame.args
local pA = frame:getParent().args
local tA = {}
local template, pF = fA['_t'], require('Module:Yesno')(fA._pf)
fA._t, fA._pf = nil, nil
if not template then
return require('Module:Error').error({'Error: no template name given.'})
end
if pF then
fA, pA = pA, fA
end
for k,v in pairs(pA) do
tA[k] = v
end
for k,v in pairs(fA) do
tA[k] = v
end
return frame:expandTemplate{title = template, args = tA}
end
return p