Module:Sandbox/BrandonXLF/1

This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 20:56, 18 February 2019 (Reverted to revision 877044953 by BrandonXLF (Reverter)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}
function p.main (frame)
	local fArgs  = frame.args -- Frame arguments
	local pArgs  = frame:getParent().args -- Parent arguments
	local tArgs  = {}
	local template = fArgs['_t'] -- Get template name
	if template == '' or template == nil then return 
		error('no template name given') -- Template name is needed
	end
	for k,v in pairs(fArgs) do
		tArgs[k] = v -- Add pArgs to tArgs
	end
	for k,v in pairs(fArgs) do
		if k ~= '_t' then -- Do not count fArgs['_t'] as a parameter
			tArgs[k] = v -- Add fArgs to tArgs
		end
	end
	return frame:expandTemplate{title = template, args = tArgs} -- Call template
end
return p