Module:Gear

local p = {} p.main = function (frame) -- Calculate the game parameter -- It's the first positional, or in the parameter named 'game' -- If game is not specified a default of S will be used local game = frame:getParent.args['game'] or frame:getParent.args[1] or 'S'   -- Calculate the category parameter -- It's the second positional, or in the parameter named 'category' -- If category is not specified a default of Headgear will be used local category = frame:getParent.args['category'] or frame:getParent.args[2] or 'Headgear' -- Calculate the name parameter -- It's the third positional, or in the parameter named 'name' -- If name is not specified a default of White Headband will be used local name = frame:getParent.args['name'] or frame:getParent.args[3] or 'White Headband' -- Calculate the size -- It's the fourth positional if specified, or in the parameter named 'size' -- If size is not specified a default of 24px will be used local size = frame:getParent.args['size'] or frame:getParent.args[4] if size then if tonumber(size) then size = string.format("%dpx", tonumber(size)) else -- size is already a string, let's assume it's correct -- unless ofc we think the size is "icononly" -- (from icononly as 4th positional without a named size param) if size == "icononly" then size = "24px" -- Default value end end else size = "24px" -- Default value end

-- Calculate if icononly -- It's the fourth or fifth positional if specified, or if a parameter named 'icononly' has value local icononly = frame:getParent.args['icononly'] or frame:getParent.args[4] == "icononly" or frame:getParent.args[5] == "icononly" -- Calculate manual image override 'mio' -- Named optional only local mio = frame:getParent.args['mio'] -- Put it all together local result = "" if not icononly then result = result .. "&#32;" .. name .. "" end

return result end

return p