Page MenuHomePhabricator

Syntactic sugar for {{#invoke:}}
Closed, DuplicatePublic


When calling {{#invoke:}} parser function, if the table returned by the invoked module does not contain a function by the name of the second argument to {{#invoke:}}, try to use call syntax on that table, which may be provided by its __call () metamethod.


local mt = {
    __call = function (...) return 0 end

local m = {
    f = function (...) return 0 end

setmetatable (m, mt)

return m

{{#invoke:M|f|g}} should return M.f (g). {{#invoke:M|g}} should return mt.__call (g).