utils/math: add a function to return a value somewhere between two numbers
This commit is contained in:
parent
c1cefa9f92
commit
8073951822
1 changed files with 6 additions and 0 deletions
|
@ -50,6 +50,12 @@ function Math.toZero(num, sub)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Math.between(num, value1, value2)
|
||||||
|
local min = math.min(value1, value2)
|
||||||
|
local max = math.max(value1, value2)
|
||||||
|
return math.min(math.max(num, min), max)
|
||||||
|
end
|
||||||
|
|
||||||
-- VECTOR/DIRECTION functions
|
-- VECTOR/DIRECTION functions
|
||||||
-- Easy-to-use function to handle point and motion
|
-- Easy-to-use function to handle point and motion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue