Reference › Function reference › Conditions

Conditions.group_state.validCompare

dependency

Call as

Conditions.group_state.validCompare(value)

Record the dependency Conditions.group_state.validCompare, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.

What it does

Checks that a Group Count value carries a known operator and a finite, non-negative number, which is at most 100 when the count is a percent of the group.

Arguments

NameTypeWhat it does
valuetableThe condition value, read for its operator, value and percent fields.

Returns

1booleanTrue when the comparison is valid.

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

Dependencies

Source

Conditions/group_state.lua, line 59. Read only in game; Duplicate makes an editable copy.

Conditions.group_state.validCompare(value)
    if value.operator == nil or not Functions.values.isin(addon.operators, value.operator) then return false end
    if type(value.value) ~= "number" or value.value ~= value.value or value.value < 0 or value.value >= math.huge then return false end
    return value.percent ~= true or value.value <= 100

Back to Function reference