From 01a30e73b2df24d023a2058b621c52ed218307cf Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 26 Aug 2021 23:23:32 +0200 Subject: [PATCH] feat: add an either function --- sonic-radiance.love/birb/utils/math.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sonic-radiance.love/birb/utils/math.lua b/sonic-radiance.love/birb/utils/math.lua index 47ded13..3d0ba85 100644 --- a/sonic-radiance.love/birb/utils/math.lua +++ b/sonic-radiance.love/birb/utils/math.lua @@ -56,6 +56,14 @@ function Math.between(num, value1, value2) return math.min(math.max(num, min), max) end +function Math.either(bool, val1, val2) + if (bool) then + return val1 + else + return val2 + end +end + -- VECTOR/DIRECTION functions -- Easy-to-use function to handle point and motion