Module:User:Surjection/invoker/default

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This is a private module sandbox of Surjection, for their own experimentation. Items in this module may be added and removed at Surjection's discretion; do not rely on this module's stability.


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