Module:Cost

local p = {} local iconModule = require('Module:Icon') local gameShortenedModule = require('Module:GameShortened')

function p.main(frame) local args = frame:getParent.args return p.getCost(args) end

function p.getCost(args) local game = gameShortenedModule.getGame(args['game'] or args[1]) local price = args['price'] or args[2] price = price and price ~= '' and price or nil -- set empty to nil local currency = args['currency'] or args[3] or 'cash' local size = args['size'] or args[4] or '24px' local isLink = args['link'] or args[5] isLink = isLink ~= nil and isLink ~= '' local textWidth = '' -- If specified, the label will be set inside a right-aligned rectangle of the specified width

-- Switch and call p.getCostEx end

function p.getCostEx(args) local group = args[1] local name = args[2] local size = args[3] local alt = string.format("%s %s", args[4], name .. pluralS) local customStyles = args[5] or '' local pluralS = args[6] and 's' or '' local textLink = string.format("%s", name, alt)

local iconArgs = { group = group, name = name, size = size, width = size, link = name, alt = alt }

local icon = iconModule.getIcon(iconArgs) local result = icon .. " "

if alt ~= '' then result = result .. " " .. textLink elseif name ~= '' then result = result .. " " .. name end

result = result .. pluralS .. " "

return result end

return p