Reference › Function reference › Core

Core.health_forecast_conditions.nativeValue

dependency

Call as

Core.health_forecast_conditions.nativeValue(self, unit, kind, cache)

Record the dependency Core.health_forecast_conditions.nativeValue, 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

Reads a unit's current or maximum health through the platform's health-forecast observer and the evaluation cache, rejecting restricted, missing, nonfinite or negative values.

Arguments

NameTypeWhat it does
selfRMAddonRotation Master addon instance whose Platform is used.
unitstringUnit token to read.
kindstring"current" or "maximum".
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.

Returns

1number | nilHealth value, or nil when unavailable.
2string | nilReason for nil: missing-api, restricted-value, the observer's reason, health-data-unavailable or invalid-health-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

Dependencies

Source

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

Core.health_forecast_conditions.nativeValue(self, unit, kind, cache)
    local platform=self.Platform
    if type(platform.GetHealthForecastValueObservation)~='function' then return nil,'missing-api' end
    local value,why=addon.Functions.cache.getCached(cache,platform.GetHealthForecastValueObservation,platform,unit,kind)
    if not platform:CanReadValue(value) then return nil,'restricted-value' end
    if value==nil then return nil,why or 'health-data-unavailable' end
    local valid,reason=finite(platform,value)
    if not valid then return nil,reason end
    if value<0 then return nil,'invalid-health-forecast-number' end
    return value

Back to Function reference