Basically If I want to round a number like 93.43434 It will return 93 but if I want to round a number that is 0.05555 I would want it to return 0.05. Can someone help me?
1 Like
Well to round down you can use math.floor
and to round up you can use math.ceil
1 Like
using just a little a bit of math you can move the decimal forward and later move it back, for exampel
local x = 0.05555
local y = x * 100 --will move the decimal back two steps (or the amount of zeros you add)
y = math.round(y)
x = y / 100 --will move the decimal forward two steps (again the amount of zeros)
print (x) -- 0.05
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.