Module:Sandbox/Ahecht: Difference between revisions

Content deleted Content added
test
test
 
(5 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(tframe, key)
t[key] = function () return "Error! Missing function " .. key end
return t[key]
end
 
Line 64 ⟶ 66:
setmetatable(p, metatable)
 
function p.dots()
return p
return t[key]dots
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
})