Call as
Platform.mobinfo2.presence(self, unit)
Record the dependency Platform.mobinfo2.presence, 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
Checks whether a unit exists with one protected UnitExists call. Returns true or false when readable; otherwise nil with "missing-api", "api-error", "restricted-value", "unit-data-unavailable" (nil result) or "invalid-api-result". GetMobInfo2Observation shares this result through the evaluation cache.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (normally addon.Platform), used for its CanReadValue check. |
unit | string | Unit token passed unchanged to UnitExists; not validated here. |
Returns
| 1 | boolean | nil | True when the unit exists, false when it does not; nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason when the result is nil. |
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 | |||||
|---|---|---|---|---|---|
UnitExists |
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
-- needs the dependency Platform.mobinfo2.presence
local exists = Platform.mobinfo2.presence(addon.Platform, "target")
if exists == nil then return nil end
return existsSource
Platform/mobinfo2.lua, line 46. Read only in game; Duplicate makes an editable copy.
Platform.mobinfo2.presence(self, unit)
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
return exists




