호출 방법
addon.Platform:GetInstanceObservation()
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
보호된 인수 없는 IsInInstance 튜플 하나를 관찰합니다. 필수인 읽을 수 있는 불리언 소속은 유형 필드와 무관합니다. 밖에 있는 것으로 알려지면 사용하지 않는 유형을 해석하지 않고 반환하며, 안에 있으면 읽을 수 있는 유형 문자열이나, 그 보조 필드를 사용할 수 없을 때 instanceTypeReason을 반환합니다. 밖인지 확인하는 쪽은 소속만 필요하며, 안의 유형을 비교하는 쪽은 보조 이유를 확인해야 합니다. 야외, 지역, 유닛 추론은 추가하지 않습니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
반환값
| 1 | table | nil | inInstance와, 안에 있으면 instanceType이나 instanceTypeReason을 담은 레코드. 소속을 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | nil인 기록에 대한 클라이언트 정책, 기본 호출 또는 필수 소속 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
| 게임 API | |||||
|---|---|---|---|---|---|
IsInInstance | |||||
canaccessvalue |
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
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"소스
Platform/instance.lua, 18번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
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}




