megaman54 Posted April 21, 2012 Share Posted April 21, 2012 Hi! I made some uptime counter wich works perfectly but it outputs too much decimals. Currently it says like this: --- Server online time ---Hours: 6.8224047222222Minutes: 409.34428333333--- Server online time --- But i want it to be like this instead: --- Server online time ---Hours: 6Minutes: 409--- Server online time --- Is there a code snippet to do this? Or some other way maybe? Link to comment
Araa Posted April 21, 2012 Share Posted April 21, 2012 math.floor , works perfectly.. I'll give you an example. local speed = (sx^2 + sy^2 + sz^2)^(0.5) local kmh = math.floor(speed*180) If the speed is 150.4561324841 Kph, it will only show 150 Kph. Link to comment
Kenix Posted April 21, 2012 Share Posted April 21, 2012 math.floor math.ceil http://lua-users.org/wiki/MathLibraryTutorial Link to comment
iChang Posted April 21, 2012 Share Posted April 21, 2012 I highly recommend you to use math.ceil as much as possible. Unless u want to use math.floor Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now