I feel dumb having to ask this, but how would I round to a specific number? I swear I used to know how, but I’m suddenly blanking.
Let’s say I want to round a number to the nearest multiple of 3. How would I go about that exactly? Is there a quick math operation, or would I have to write my own math function?
But math.ceil(1.4) would produce 2. I wanted to round specifically by 3’s. @GolgiToad is the answer I was looking for. Thank you for the response though, and you as well @lolmansReturn.
function roundtosomething(numba,specificnumber)
local num = "0."
for i = 1,specificnumber do
num ..= 0
end
num ..= 5
return math.floor(numba+tonumber(num))
end
print(roundtosomething(4.005,2)) -- 4.01