feat(math): add a basic wrap and limit function
This commit is contained in:
parent
12b4b3fbc1
commit
876d30671d
1 changed files with 9 additions and 0 deletions
|
@ -56,6 +56,15 @@ function Math.between(num, value1, value2)
|
|||
return math.min(math.max(num, min), max)
|
||||
end
|
||||
|
||||
function Math.wrapAndLimit(num, min, max)
|
||||
if (num < min) then
|
||||
num = max
|
||||
elseif (num > max) then
|
||||
num = min
|
||||
end
|
||||
return num
|
||||
end
|
||||
|
||||
-- VECTOR/DIRECTION functions
|
||||
-- Easy-to-use function to handle point and motion
|
||||
|
||||
|
|
Loading…
Reference in a new issue