Jump to content

Another help please


Snaik

Recommended Posts

Posted

I want to get a divided results to only show two numbers after the coma. how do i do that ?

like :

9 divided by 7 = 1,28571429

i only want it to show "1,28".

Sorry for asking too much questions :oops: .

Posted
  
local n = tonumber(string.format("%.2f", 9/7)) 
-- n == 1.29 
  

PS: if you dont need it as a number for further calculations (like if you're just going to display it somewhere), you can drop tonumber().

but keep in mind that it will add zeros to integers (like 9/9 will result in 1.00 without tonumber)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...