호출 방법
addon.Platform:GetPetObservation(includeName)
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
정확한 소환수 존재 여부와, 선택적으로 GetUnitName의 형식화된 표시 이름을 관찰합니다. 존재만 확인하는 조회는 이름 데이터를 요구하지 않습니다. 없는 것으로 알려지면 이름 조회를 건너뜁니다. 있는 소환수는 요청할 때만 읽을 수 있는 비어 있지 않은 이름이 필요하며, 필수 관찰이 없거나, 실패하거나, nil이거나, 제한되거나, 잘못되면 nil과 이유를 반환합니다. 표시 도우미는 원래의 소환수 인수 하나로 호출되며, UnitName 대체나 단축바, 생명력, 기술 상태 추론은 없습니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
includeName | boolean | nil | true면 형식화된 소환수 이름을 요청하고, false나 생략하면 존재만 읽습니다. |
반환값
| 1 | table | nil | 불리언 exists와, 요청했고 소환수가 있으면 name을 담은 소환수 관찰. 필수 데이터를 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | nil인 소환수 관찰에 대한 정책, 조회 검증 또는 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
| 게임 API | |||||
|---|---|---|---|---|---|
GetUnitName | |||||
UnitExists | |||||
canaccessvalue |
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
local pet = addon.Platform:GetPetObservation(false)
if not pet then return nil end
return not pet.exists -- time to summon소스
Platform/pet.lua, 19번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
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




