Module:Sandbox/Wnt
Appearance
Documentation for this module may be created at Module:Sandbox/Wnt/doc
-- flaws in the current implementation are:
-- * Looks at every args[i]
-- * Allows an "=" in the first parameter (i.e. the function) but that screws up all the other args in a way I don't understand.
local p = {}
local getArgs = require("Module:Arguments").getArgs
function p.main(frame, k)
local oargs = getArgs(frame)
local args = {[1] = k}
if k then offset = 1 else offset = 0 end
local i = 0
repeat
i = i + 1
args[i+offset] = oargs[i]
until (not oargs[i])
setmetatable(args, {__index = oargs}) -- to allow the new "args" to return the original named parameters
return "test args are 1 = " .. (args[1] or "") .. "; 2 = " .. (args[2] or "") .. "; 3 = " .. (args[3] or "") .. "; named = " .. (args['named'] or "NULL")
end
local q = {
__index = function (t, k, whozis)
return function(frame) return t.main(frame,k) end
end
}
setmetatable(p,q)
return p