Module:Sandbox/BrandonXLF/1

This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 00:38, 31 March 2023 (Restored revision 1025694786 by BrandonXLF (Restorer)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- Sandbox, do not delete

function main (frame, switch)
	local fArgs = frame.args
	local pArgs = frame:getParent().args
	local tArgs = {}
	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(fArgs) do
		tArgs[k] = v
	end
	for k, v in pairs(pArgs) do
		tArgs[k] = v
	end
	return frame:expandTemplate{title = template, args = tArgs}
end

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