Jump to content

[HELP]Round Amount


AncienT

Recommended Posts

Posted (edited)

There is some way to convert any rounded quantity from 5 to 5 for example the amount 893 that rounds to 895 or de quantity 562 is rounded to 560

Edited by AncienT
  • Moderators
Posted (edited)
math.floor(value / 10 + 0.5) * 10

This round based on 10. (Inspiration)

__________________________________

 

Experimental

local value = 342

local restValue = value % 5

print(restValue)

if restValue > 2.5 then
value = value + 5 - restValue
else
value = value - restValue
end

print(restValue)



print(value)

 

Edited by IIYAMA
  • Thanks 1

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...