Module:PriceCalculator: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
function p._calculate(price, priceType) | function p._calculate(price, priceType) | ||
price = tostring(price):gsub(",", "") -- remove commas | |||
price = tonumber(price) | price = tonumber(price) | ||
if not price or price < 0 then | if not price or price < 0 then | ||
Line 20: | Line 19: | ||
return math.floor(price * factor + 0.5) | return math.floor(price * factor + 0.5) | ||
end | end | ||