Reference › Function reference › Platform

Platform.health_forecast.GetHealthForecastIdentityObservation

public

Call as

addon.Platform:GetHealthForecastIdentityObservation(unit)

Available directly through addon; no dependency is needed.

What it does

On probe- and restricted-policy clients, observe exact UnitExists(unit), then UnitGUID(unit) only for a present unit. Known absence is false. Present identity requires a readable nonempty GUID; missing, failed, malformed or restricted required facts are unavailable. No health, provider or extra-unit observation is added.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).
unitstringSelected nonempty unit token.

Returns

1string | boolean | nilPresent GUID, false for known absence, or nil when unavailable.
2string | nilPolicy, validation or observation availability reason.

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.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
UnitExistsClassic EraTBC AnniversaryClassic progressionForeverRetail
UnitGUIDClassic EraTBC AnniversaryClassic progressionForeverRetail
canaccessvalueClassic EraTBC AnniversaryClassic progressionForeverRetail

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.

Example

local guid = addon.Platform:GetHealthForecastIdentityObservation("target")
-- false when there is no target, nil when unavailable
if not guid then return guid end
return guid:sub(1, 9) == "Creature-"

Source

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

Platform.health_forecast.GetHealthForecastIdentityObservation(self, unit)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    if not self:CanReadValue(unit) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    if type(UnitExists)~='function' then return nil,'missing-api' end
    local ok,exists=pcall(UnitExists,unit)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(exists) then return nil,'restricted-value' end
    if exists==nil then return nil,'unit-data-unavailable' end
    if type(exists)~='boolean' then return nil,'invalid-api-result' end
    if not exists then return false end
    if type(UnitGUID)~='function' then return nil,'missing-api' end
    local success,guid=pcall(UnitGUID,unit)
    if not success then return nil,'api-error' end
    if not self:CanReadValue(guid) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(guid) then return nil,'restricted-value' end
    if guid==nil then return nil,'unit-guid-unavailable' end
    if type(guid)~='string' or guid=='' then return nil,'invalid-api-result' end
    return guid

Back to Function reference