mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add math.onemod
This commit is contained in:
parent
53df320988
commit
4402f2a054
5
math.lua
5
math.lua
@ -23,6 +23,11 @@ function sign(number)
|
||||
if number > 0 then return 1 end
|
||||
end
|
||||
|
||||
-- one-based mod
|
||||
function onemod(number, modulus)
|
||||
return ((number - 1) % modulus) + 1
|
||||
end
|
||||
|
||||
function round(number, steps)
|
||||
steps = steps or 1
|
||||
return math_floor(number * steps + 0.5) / steps
|
||||
|
Loading…
Reference in New Issue
Block a user