Add math.sign() function

master
Karl F 2021-01-03 20:12:55 +01:00 committed by Webster Sheets
parent b8f255f8d2
commit b5dcfc8e85
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,10 @@ math.round = function(v)
return (math.modf(v + (v < 0.0 and -.5 or .5)))
end
math.sign = function(v)
return (v > 0 and 1) or (v == 0 and 0) or -1
end
math.clamp = function(v, min, max)
return math.min(max, math.max(v,min))
end