I need help making a script that will automatically convert numbers and intergers into a decimal, like for money. So if I had 64 dollars it would say 64.00, etc
The API provides a string.format function that can do just that:
local dollars = 64
print(string.format(
"%.2f",--"%f" means insert a float here. the ".2" inside indicates rounding to 2 places
dollars
))--should print 64.00
You can read more about it in the manual.
1 Like
Do you mean for only whole numbers? And can I get more information?