Call as
addon.Platform:GetInstanceObservation()
Available directly through addon; no dependency is needed.
What it does
Observe one protected zero-argument IsInInstance tuple. Required readable Boolean membership is independent of the type field: known outside returns without interpreting the unused type; inside returns a readable string type or an instanceTypeReason when that secondary field is unavailable. Callers testing outside need only membership; inside type comparisons must check the secondary reason. No outdoors, zone or unit inference is added.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (implicit with colon calls). |
Returns
| 1 | table | nil | Record with inInstance and, when inside, instanceType or instanceTypeReason; nil when membership is unavailable. |
|---|---|---|
| 2 | string | nil | Client-policy, native-call or required membership 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 API | |||||
|---|---|---|---|---|---|
IsInInstance | |||||
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 record = addon.Platform:GetInstanceObservation()
if not record then return nil end
if not record.inInstance then return false end
if not record.instanceType then return nil end
return record.instanceType == "raid"Source
Platform/instance.lua, line 18. Read only in game; Duplicate makes an editable copy.
Platform.instance.GetInstanceObservation(self)
local family=self:GetClientFamily()
if family~='retail' and family~='forever' and family~='era' and family~='tbc' and family~='progression' then return nil,'unsupported-policy' end
if type(IsInInstance)~='function' then return nil,'missing-api' end
local ok,inInstance,instanceType=pcall(IsInInstance)
if not ok then return nil,'api-error' end
if not self:CanReadValue(inInstance) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(inInstance) then return nil,'restricted-value' end
if inInstance==nil then return nil,'instance-data-unavailable' end
if type(inInstance)~='boolean' then return nil,'invalid-api-result' end
if not inInstance then return {inInstance=false} end
if not self:CanReadValue(instanceType) then return {inInstance=true,instanceTypeReason='restricted-value'} end
if canaccessvalue and not canaccessvalue(instanceType) then return {inInstance=true,instanceTypeReason='restricted-value'} end
if instanceType==nil then return {inInstance=true,instanceTypeReason='instance-type-unavailable'} end
if type(instanceType)~='string' then return {inInstance=true,instanceTypeReason='invalid-api-result'} end
return {inInstance=true,instanceType=instanceType}




