Hello! I’m here looking for help so I can figure out how to convert my numbers into correct GBP format. So far, my code works as it converts long decimals into smaller 2 decimal place numbers.
Here’s my code:
function module.ToDecimalPlace(value)
value *= 100
value = math.floor(value)
value = value / 100
return value
end
Let’s say “value” in the parameters is 1400.91152
My code will successfully convert this decimal to 2 decimal places.
1400.911.52 ==> 1400.9
The problem being it ends with .9
I need my code to end it with .90 instead to format it correctly as currency.
Any help is appreciated, I don’t think this is a very difficult topic but do let me know if you have any confusions or questions!