Reference › Function reference › Core

Core.threat_count_conditions.finite

dependency

Call as

Core.threat_count_conditions.finite(platform, value)

Record the dependency Core.threat_count_conditions.finite, 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 threat-count number is readable and finite.

Arguments

NameTypeWhat it does
platformRMPlatformPlatform whose CanReadValue decides readability.
valueanyValue to check.

Returns

1booleanTrue when the value is a readable finite number.
2string | nilWhen false: restricted-value or invalid-threat-count-number.

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

Core/threat_count_conditions.lua, line 20. Read only in game; Duplicate makes an editable copy.

Core.threat_count_conditions.finite(platform, value)
    if not platform:CanReadValue(value) then return false,'restricted-value' end
    if type(value)~='number' or value~=value or value>=math.huge or value<=-math.huge then return false,'invalid-threat-count-number' end
    return true

Back to Function reference