Module:Sandbox/Wnt
Appearance
-- The entire meat of the module can be up front with fields of some table that isn't p.
local q = {}
function q.main (action, args)
return "action = " .. (action or 'NIL') .. "args[1] = " .. (args[1] or 'NIL')
end
-- this final act returns p with the available functions set. The setmetatable has to be after q is created and q.main defined
local p = {} -- this empty table with metatable serves to convert the first #invoke field to an effective parameter
setmetatable(p, { __index = function(t, k)
return function(frame)
return q.main (k, frame.args)
end
end })
return p