Call as
addon.Platform:GetPetObservation(includeName)
Available directly through addon; no dependency is needed.
What it does
Observe exact pet existence and optionally its formatted GetUnitName display name. Presence-only queries never require name data. Known absence skips the name query. Present pets require a readable nonempty name only when requested; required missing, failed, nil, restricted or malformed observations return nil with a reason. The display helper is called with its single original pet argument, without UnitName fallback or inferred bar, health or ability state.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (implicit with colon calls). |
includeName | boolean | nil | True requests the formatted pet name; false or omitted reads presence only. |
Returns
| 1 | table | nil | Pet observation with Boolean exists and, for a requested present pet, name; nil when required data is unavailable. |
|---|---|---|
| 2 | string | nil | Policy, query-validation or availability reason for a nil pet observation. |
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 API | |||||
|---|---|---|---|---|---|
GetUnitName | |||||
UnitExists | |||||
canaccessvalue |
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 pet = addon.Platform:GetPetObservation(false)
if not pet then return nil end
return not pet.exists -- time to summonSource
Platform/pet.lua, line 19. Read only in game; Duplicate makes an editable copy.
Platform.pet.GetPetObservation(self, includeName)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
if not self:CanReadValue(includeName) then return nil,'restricted-value' end
if includeName~=nil and type(includeName)~='boolean' then return nil,'invalid-pet-query' end
if type(UnitExists)~='function' then return nil,'missing-api' end
local ok,exists=pcall(UnitExists,'pet')
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,'pet-data-unavailable' end
if type(exists)~='boolean' then return nil,'invalid-api-result' end
local record={exists=exists}
if not exists or not includeName then return record end
if type(GetUnitName)~='function' then return nil,'missing-api' end
local nameOk,name=pcall(GetUnitName,'pet')
if not nameOk then return nil,'api-error' end
if not self:CanReadValue(name) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(name) then return nil,'restricted-value' end
if name==nil then return nil,'pet-name-unavailable' end
if type(name)~='string' or name=='' then return nil,'invalid-api-result' end
record.name=name
return record




