Call as
Functions.values.compare(operator, left, right)
Record it as a dependency named Functions.values.compare (accepting the completion does this), then call it by that name.
Also accepted under the former namespace utils.
What it does
Compare two values using an RM operator identifier: LESSTHAN, LESSTHANOREQUALS, GREATERTHAN, GREATERTHANOREQUALS, EQUALS, NOTEQUALS or DIVISIBLE. Invalid operators warn and return nil; operands must support the selected Lua operation.
Arguments
| Name | Type | What it does |
|---|---|---|
operator | string | RM operator identifier. |
left | any | Left operand; use numbers for ordering and divisibility. |
right | any | Right operand; DIVISIBLE requires a nonzero divisor. |
Returns
| 1 | boolean | nil | Comparison result, or nil for an unknown operator. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
How the addon calls it
- Any Spell Charges (evaluate)
return Functions.values.compare(value.operator, charges.currentCharges, value.value) - Any Spell Cooldown (evaluate)
return Functions.values.compare(value.operator, remain, value.value) - Any Spell Recharge Time (evaluate)
return Functions.values.compare(value.operator, remain, value.value) - Boss Mod Encounter Stage (evaluate)
return Functions.values.compare(value.operator, stage, value.value) - Boss Mod Timer (evaluate)
return Functions.values.compare(value.operator, remaining, value.value) - Cast Progress (evaluate)
return Functions.values.compare(value.operator,done,value.value) - Cast Time Remaining (evaluate)
return Functions.values.compare(value.operator,record.remainingSeconds,value.value) - Channel Progress (evaluate)
return Functions.values.compare(value.operator,done,value.value)
and 56 more: Channel Time Remaining (evaluate), Class In Group (evaluate), Combat Action History (evaluate), Distance Count (evaluate), Eclipse (evaluate), Extended Character Stat (evaluate), Extended Character Stat Percentage (evaluate), Group Count (evaluate), Health (evaluate), Health Percentage (evaluate), Mythic+ Keystone Level (evaluate), Level (evaluate), Loss Of Control Blocked (evaluate), Loss Of Control Type (evaluate), Mana (evaluate), Mana Percentage (evaluate), Raid Mark Count (evaluate), Pet Spell Charges (evaluate), Pet Spell Cooldown (evaluate), Pet Spell Cast History (evaluate), Pet Spell Recharge Time (evaluate), Points (evaluate), Power (evaluate), Power Percentage (evaluate), Allies Within Range (evaluate), Health Within Range (evaluate), Health Percentage Within Range (evaluate), Health Percentage Count Within Range (evaluate), Health Count Within Range (evaluate), Mana Within Range (evaluate), Mana Percentage Within Range (evaluate), Mana Percentage Count Within Range (evaluate), Mana Count Within Range (evaluate), Resistant (evaluate), Runes (evaluate), Rune Cooldown (evaluate), Level (evaluate), Item Set Pieces Equipped (evaluate), Spell Charges (evaluate), Spell Cooldown (evaluate), Spell Cast History (evaluate), Spell Recharge Time (evaluate), Stagger (evaluate), Character Stat (evaluate), Weapon Swing Time (evaluate), Weapon Swing Time Remaining (evaluate), Talent (evaluate), Talent Tree Points (evaluate), Threat Count (evaluate), Time Since Combat Start (evaluate), Totem Time Remaining (evaluate), Time Until Health (evaluate), Time Until Health Percentage (evaluate), Weapon Enchant Time Remaining (evaluate), Weapon Enchant Stacks (evaluate), Conditions.spatial.nameplateDistanceCount
Source
Functions/values.lua, line 22. Read only in game; Duplicate makes an editable copy.
Functions.values.compare(operator, left, right)
if operator == "LESSTHAN" then
return left < right
elseif operator == "LESSTHANOREQUALS" then
return left <= right
elseif operator == "GREATERTHAN" then
return left > right
elseif operator == "GREATERTHANOREQUALS" then
return left >= right
elseif operator == "EQUALS" then
return left == right
elseif operator == "NOTEQUALS" then
return left ~= right
elseif operator == "DIVISIBLE" then
return (left % right) == 0
else
addon:warn("Invalid Operator %s", operator)
end