Module:Sandbox/BrandonXLF/1

This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 23:39, 4 January 2020 (This should work). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

function main (args1, args2, switch) 
	local template = args2['_']
	args2._ = nil
	if switch then
		args1, args2 = args2, args1
	end
	if not template then
		return require('Module:Error').error({'Error: no template name given.'})
	end
	for k,v in pairs(args1) do
		args2[k] = v
	end
	return frame:expandTemplate{title = template, args = args2}
end

function gen (switch)
	return function (frame)
		return main(frame:getParent().args, frame.args, switch)
	end
end

return {
	default = gen(false),
	force = gen(true)
}