Reference › Function reference › Conditions

Conditions.weapon.numericObservation

dependency

Call as

Conditions.weapon.numericObservation(value)

Record the dependency Conditions.weapon.numericObservation, 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

Accepts a readable, nonnegative, finite number from a weapon observation and returns it unchanged; anything else becomes nil with a reason.

Arguments

NameTypeWhat it does
valueanyObserved value, such as an expiration time or swing speed.

Returns

1number | nilThe value, or nil when it is not usable.
2string | nilReason for nil: restricted-value or invalid-weapon-observation.

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.

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

How the addon calls it

Source

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

Conditions.weapon.numericObservation(value)
    if not addon.Platform:CanReadValue(value) then return nil,"restricted-value" end
    if type(value)~="number" or value~=value or value<0 or value==math.huge then return nil,"invalid-weapon-observation" end
    return value

Back to Function reference