Clamp a value between a minimum and maximum. Supports numbers and vector types. Vectors will have their components clamped between the same indices of the minimum/maximum vectors. All parameters must be of the same type, and the return value will be of the same type as the parameters.
result = math.clamp(x, min, max)
- The value to clamp.
- The minimum value.
- The maximum value.
- The clamped value.
- This function implies the argument type based on the first argument. As such, you may not use table shorthand for the first argument if it is supposed to be a vector.