레퍼런스 › 함수 레퍼런스 › Platform

Platform.unit_presence.GetUnitPresenceObservation

공개

호출 방법

addon.Platform:GetUnitPresenceObservation(unit)

addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.

하는 일

식별된 클라이언트 계열에서 유닛 존재 여부를 관찰합니다. 선택한 유닛을 보호된 UnitExists 호출 한 번에 그대로 전달합니다. 읽을 수 있는 true와 false를 보존하며, 필수 관찰이 없거나, 실패하거나, 제한되거나, nil이거나, 잘못되면 nil과 이유를 반환합니다. 식별, 가시성, 사거리, 전투 상태 조회는 추가하지 않습니다.

인수

이름유형하는 일
selfRMPlatformRotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적).
unitstring유일한 기본 인수로 그대로 전달되는 읽을 수 있는 비어 있지 않은 유닛 토큰.

반환값

1boolean | nil알려진 유닛 존재 여부. 필수 관찰을 사용할 수 없으면 nil.
2string | nilnil 결과에 대한 클라이언트 계열, 조회 검증 또는 필수 관찰 사용 불가 이유.

버전

기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.

  • 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
  • Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
게임 APIClassic EraTBC AnniversaryClassic progressionForeverRetail
UnitExistsClassic EraTBC AnniversaryClassic progressionForeverRetail

비공개 값 (Retail과 Forever)

Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.

예시

local present = addon.Platform:GetUnitPresenceObservation("focus")
if present == nil then return nil end
return not present

소스

Platform/unit_presence.lua, 65번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.

Platform.unit_presence.GetUnitPresenceObservation(self, unit)
    if not self:CanReadValue(unit) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    if self:GetClientFamily()=='unknown' then return nil,'unsupported-client' end
    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

함수 레퍼런스(으)로 돌아가기