Split out comparator names into a public table for conditions to access.
Johnny C. Lam [05-08-14 - 17:25]
Split out comparator names into a public table for conditions to access.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1392 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvaleCondition.lua b/OvaleCondition.lua
index 36656b6..63105ce 100644
--- a/OvaleCondition.lua
+++ b/OvaleCondition.lua
@@ -77,6 +77,14 @@ OvaleCondition.ParseCondition = nil
OvaleCondition.ParseRuneCondition = nil
OvaleCondition.TestBoolean = nil
OvaleCondition.TestValue = nil
+
+OvaleCondition.COMPARATOR = {
+ atLeast = true,
+ atMost = true,
+ equal = true,
+ less = true,
+ more = true,
+}
--</public-static-properties>
--<public-static-methods>
@@ -202,9 +210,8 @@ OvaleCondition.TestValue = function(start, ending, value, origin, rate, comparat
else
return 0, math.huge, 0, 0, 0
end
- elseif comparator ~= "atLeast" and comparator ~= "atMost" and comparator ~= "equal"
- and comparator ~= "less" and comparator ~= "more" then
- Ovale:Errorf("unknown compare term %s", comparator)
+ elseif not OvaleCondition.COMPARATOR[comparator] then
+ Ovale:Errorf("unknown comparator %s", comparator)
elseif not limit then
Ovale:Errorf("comparator %s missing limit", comparator)
elseif rate == 0 then