Added increment rounding to lume.round()

This commit is contained in:
rxi
2014-03-02 21:29:23 +00:00
parent d344b9d04e
commit f2877dbd6e
2 changed files with 10 additions and 4 deletions

View File

@@ -15,7 +15,8 @@ function lume.clamp(x, min, max)
end
function lume.round(x)
function lume.round(x, increment)
if increment then return lume.round(x / increment) * increment end
return x > 0 and math.floor(x + .5) or math.ceil(x - .5)
end