sonic-radiance/sonic-radiance.love/game/events/conditions/utils.lua

31 lines
715 B
Lua
Raw Normal View History

2021-03-22 16:12:15 +01:00
local ConditionsUtils = {}
function ConditionsUtils.testVariables(var1, testType, var2)
local var2 = tonumber(var2)
if (testType == "eq" and var1 == var2) then
return true
end
if (testType == "ne" and var1 ~= var2) then
return true
end
if (testType == "gt" and var1 > var2) then
return true
end
if (testType == "ge" and var1 >= var2) then
return true
end
if (testType == "lt" and var1 < var2) then
return true
end
if (testType == "le" and var1 <= var2) then
return true
end
return false
end
function ConditionsUtils.testBool(bool, boolType)
return (bool == (boolType == "V"))
end
return ConditionsUtils;