formatting to 2 decimal places

Posted by Silencher on Fri 27 Mar 2015 02:25 PM — 2 posts, 12,261 views.

#0
Hello,

I don't know why, but I can't seem to get a percentage to format to 2 decimals.

Here's what I'm trying

Percent = string.format ("%.2f", Percent)


This does not work.
Australia Forum Administrator #1
Try this:


 Percent = 12.345678

print (string.format ("%.2f", Percent))


Output:


12.35