Module:PriceCalculator
Documentation for this module may be created at Module:PriceCalculator/doc
function p._calculate(price, priceType)
price = tostring(price):gsub(",", "") -- remove commas
price = tonumber(price)
if not price or price < 0 then
return "Invalid price"
end
local percent = {
sell = 0.6675,
minor = 0.5,
major = 1.0
}
local factor = percent[priceType]
if not factor then
return "Invalid type"
end
return math.floor(price * factor + 0.5)
end