Fixed clamping once more

This commit is contained in:
Ishaan Bhardwaj 2021-03-04 19:05:20 -05:00
parent e7bb44deb4
commit 37c85adc75

View File

@ -88,5 +88,8 @@ function table.contains(table, element)
end end
function clamp(x, min, max) function clamp(x, min, max)
return (x < min and min or (x > max and max or x)) if max < min then
min, max = max, min
end
return x < min and min or (x > max and max or x)
end end