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
| Name | Type | What it does |
|---|---|---|
self | RMAddon | Rotation Master addon instance whose Platform is used. |
unit | string | Unit token to read. |
kind | string | "current" or "maximum". |
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
Returns
| 1 | number | nil | Health value, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason 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
Core.health_forecast_conditions.GetConditionHealthForecastif current==nil or current==false then current,why=nativeValue(self,unit,'current',cache);if current==nil then return nil,why end end
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