Fixed clamping once more

pull/16/head
Ishaan Bhardwaj 2021-03-04 19:05:20 -05:00
parent e7bb44deb4
commit 37c85adc75
1 changed files with 4 additions and 1 deletions

View File

@ -88,5 +88,8 @@ function table.contains(table, element)
end
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