Reference › Function reference › Platform

Platform.points.GetUnitPointIdentityObservation

public

Call as

addon.Platform:GetUnitPointIdentityObservation(unit, includeClass)

Available directly through addon; no dependency is needed.

What it does

Observe exact selected-unit existence and optionally its class filename for point-resource conditions. Known absence returns exists=false without reading class. Present units require only UnitClass return two when requested; unused localized names and IDs do not affect availability. Required missing, failed, restricted or malformed observations remain unavailable. This does not select a resource or cache identity.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).
unitstringExact unit token passed unchanged to UnitExists and, when required, UnitClass.
includeClassbooleanTrue also requires the present unit class filename; false reads existence only.

Returns

1table | nilReadable record with Boolean exists and the requested class filename when present; nil when required data is unavailable.
2string | nilPolicy, query-validation or required observation availability reason for a nil record.

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
UnitClassClassic EraTBC AnniversaryClassic progressionForeverRetail
UnitExistsClassic 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 record = addon.Platform:GetUnitPointIdentityObservation("target", true)
if not record then return nil end
return record.exists and record.class == "ROGUE"

Source

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

Platform.points.GetUnitPointIdentityObservation(self, unit, includeClass)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    if not self:CanReadValue(unit) or not self:CanReadValue(includeClass) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    if type(includeClass)~='boolean' then return nil,'invalid-point-identity-query' end
    if type(UnitExists)~='function' then return nil,'missing-api' end
    local existsOK,exists=pcall(UnitExists,unit)
    if not existsOK then return nil,'api-error' end
    if not self:CanReadValue(exists) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(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 {exists=false} end
    if not includeClass then return {exists=true} end
    if type(UnitClass)~='function' then return nil,'missing-api' end
    local ok,_,class=pcall(UnitClass,unit)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(class) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(class) then return nil,'restricted-value' end
    if class==nil then return nil,'point-class-unavailable' end
    if type(class)~='string' or class=='' then return nil,'invalid-api-result' end
    return {exists=true,class=class}

Back to Function reference