Module:Sandbox/Ahecht: Difference between revisions

Content deleted Content added
dots
test
 
(4 intermediate revisions by the same user not shown)
Line 58:
end
 
function error(tframe, key)
t[key] = function () return "Error! Missing function " .. key end
return t[key]
end
 
Line 71 ⟶ 70:
end
 
function p.prefix(frame)
return p
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
})