Module:Sandbox/BrandonXLF/1

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

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

return {
	default = function (frame) return main(frame) end,
	force = function (frame) return main(frame, true) end
}