Anonymous user
Module:Template invocation: Difference between revisions
validate the keys and values in the args table in p.invocation
(add a p.name function to find the template name, use checkType with p.invocation, and add some function description comments) |
(validate the keys and values in the args table in p.invocation) |
||
Line 60:
checkType('invocation', 3, format, 'string', true)
--
--
--
local invArgs = {}
for k, v in pairs(args) do
local typek = type(k)
local typev = type(v)
if type(k) ~= 'string' and type(k) ~= 'number'
or type(v) ~= 'string' and type(v) ~= 'number'
then
error("invalid arguments table in parameter #2 of " ..
"'invocation' (keys and values must be strings or numbers)", 2)
end
invArgs[k] = v
end
|