Content deleted Content added
test |
test |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1:
local p = {}
local dots = ...
function p.main(frame)
local output = {}
Line 55 ⟶ 58:
end
function error(frame, key)
return "Error! Missing function " .. key
end
metatable = {['__index'] = error}
setmetatable(p, metatable)
function p.dots()
return
end
function p.prefix(frame)
local args = {}
for k,v in pairs(frame.args) do
if k ~= '_prefix' and k ~= '_template' then
table.insert(args, '| ' .. (frame.args['_prefix'] or '') .. k .. " = " .. v)
end
end
return table.concat(args, '\n')
end
return setmetatable(p, {__index =
function(_, key) -- this anonymous function called as function(TABLE, KEY)
return function (frame) return error (frame, key) end; -- which in turn returns a function that calls cite() with the KEY name
end
})
|