Module:Params/testcases/mdummy
Jump to navigation
Jump to search
[edit source]
File:Test Template Info-Icon - Version (2).svg Module documentation[view] [edit] [history] [purge]
This submodule is designed to be used as a dummy callback by templates that want to test Module:Params.
Usage
[edit source]{{#invoke:Params/testcases/mdummy|function_name}}
Functions
[edit source]Here follows the list of functions.
echo_sb
[edit source]The echo_sb function simply echoes all the parameters it was called with, surrounding these within square brackets. It is virtually identical to the {{Module:Params/testcases/tdummy echo sb}} template.
Examples:
{{#invoke:params/testcases/mdummy|echo_sb|foo|bar|Jupiter|hello=world}}- ↳ [1=foo][2=bar][3=Jupiter][hello=world]
local iface = {}
iface.echo_sb = function(frame)
local args = frame.args
local ret = ''
local keys = {}
for key,val in ipairs(args) do
if not keys[key] then
ret = ret .. '[' .. key .. '=' .. val .. ']'
keys[key] = true
end
end
for key,val in pairs(args) do
if not keys[key] then
ret = ret .. '[' .. key .. '=' .. val .. ']'
keys[key] = true
end
end
return ret
end
return iface