Module math_extras
Extra functionality for Lua's math library.
Functions
| math.clamp (x, min, max) | Returns the value x clamped between an upper (max) and lower bounds (min). |
| math.lerp (from, to, amount) | Linearly interpolates values from and to by amount. |
Functions
- math.clamp (x, min, max)
-
Returns the value
xclamped between an upper (max) and lower bounds (min). Any values comparable by order, that is, with a less than operator, can be passed in.Parameters:
- x Vector2, Vector3, Color or number
- min Vector2, Vector3, Color or number
- max Vector2, Vector3, Color or number
Returns:
- math.lerp (from, to, amount)
-
Linearly interpolates values
fromandtobyamount. Equivalent tofrom + (amount * (to - from)).Parameters:
- from Vector2, Vector3, Color, Quat or number
- to Vector2, Vector3, Color, Quat or number
- amount number
Returns: