Function clamp
Source pub fn clamp(x: number, min: number, max: number) -> number
Available on crate feature extended only.
Expand description
Restricts a number to a range.
Extended library — feature extended (from extended.lua).
From Rust f64::clamp.
§Examples
print(math.clamp(5, 1, 3)) --> 3
print(math.clamp(-5, 1, 3)) --> 1
print(math.clamp(2, 1, 3)) --> 2
§See also
min, max