diff options
Diffstat (limited to 'pkgs/astal/src/lib.lua')
-rw-r--r-- | pkgs/astal/src/lib.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/astal/src/lib.lua b/pkgs/astal/src/lib.lua index 98a5ecc..23c5dd1 100644 --- a/pkgs/astal/src/lib.lua +++ b/pkgs/astal/src/lib.lua @@ -103,6 +103,16 @@ lib = { return lib.count(array) == 0 end, + --- clamps a number between two other numbers + clamp = function(num, low, high) + if low and num < low then + return low + elseif high and num > high then + return high + end + return num + end, + --- negates value neg = function(val) return not val |