Reference › Function reference › Functions

Functions.forecast.finite

dependency

Call as

Functions.forecast.finite(platform, value)

Record the dependency Functions.forecast.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 number used by Functions.forecast.calculate 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-forecast-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

Functions/forecast.lua, line 23. Read only in game; Duplicate makes an editable copy.

Functions.forecast.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-forecast-number' end
    return true

Back to Function reference