Editing Module:Rates
From Ephinea PSO Wiki
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 89: | Line 89: | ||
end | end | ||
-- Even if we're displaying one or more decimal places, cut zeroes off | -- Even if we're displaying one or more decimal places, cut zeroes off | ||
out = string.format("1/%." .. digits .. "f", 1/rate) | out = out .. string.format("%s", string.format("1/%." .. digits .. "f", 1/rate)):gsub("%.?0+$", "") | ||
else | else | ||
out = wholeFractions[rate] | out = out .. wholeFractions[rate] | ||
end | end | ||
return out | return out | ||
elseif fmt == "p" then | elseif fmt == "p" then | ||
-- Display up to five decimal places. Cut zeroes off | -- Display up to five decimal places. Cut zeroes off | ||
rate = string.format("%s%%", string.format("%f", string.format("%.5f", rate*100)):gsub("%.?0+$", "")) | |||
out = out .. rate | |||
return out | |||
return | |||
end | end | ||
end | end |