Skip to content

Commit

Permalink
Merge pull request yanghuan#224 from DezZolation/master
Browse files Browse the repository at this point in the history
Added Math.Clamp
  • Loading branch information
yanghuan authored May 18, 2019
2 parents b9cb459 + 636f8d8 commit 7020562
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CSharp.lua/CoreSystem.Lua/CoreSystem/Math.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,9 @@ Math.Sign = function(v)
return v == 0 and 0 or (v > 0 and 1 or -1)
end

Math.Clamp = function(v, min, max)
return Math.Min(Math.Max(v, min), max)
end

Math.Truncate = System.trunc
System.define("System.Math", Math)

0 comments on commit 7020562

Please sign in to comment.