mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add math.clamp
This commit is contained in:
parent
ead91a1e5d
commit
b52fee94af
6
math.lua
6
math.lua
@ -23,6 +23,10 @@ function sign(number)
|
||||
if number > 0 then return 1 end
|
||||
end
|
||||
|
||||
function clamp(number, min, max)
|
||||
return math.min(math.max(number, min), max)
|
||||
end
|
||||
|
||||
log = setmetatable({}, {
|
||||
__index = function(self, base)
|
||||
local div = math.log(base)
|
||||
@ -124,4 +128,4 @@ function fround(number)
|
||||
end
|
||||
|
||||
-- Export environment
|
||||
return _ENV
|
||||
return _ENV
|
||||
|
Loading…
Reference in New Issue
Block a user