Jump to content

Module:User:Surjection/invoker/default

From Wiktionary, the free dictionary


local getParent = function (frame) return frame._parent end

local function makeFakeFrame(tempargs, args)
	local frame = { }
	frame._parent = { ["args"] = args }
	frame.getParent = getParent
	frame.args = tempargs
	return frame
end

-- tries to construct a fake frame and call a template entry point with it
return function (entry, tempargs)
	return function (args)
		return entry(makeFakeFrame(tempargs or nil, args))
	end
end