Call as
addon.Platform:GetUnitCreatureTypeID(unit)
Available directly through addon; no dependency is needed.
What it does
Observe creature identity from native UnitCreatureType return two on probe- and restricted-policy clients. Check exact UnitExists(unit) first; readable false returns false without requiring or calling creature metadata. A present unit requires a readable finite numeric ID; the unused localized name does not affect availability. Preserve signed, fractional, zero and future finite IDs as known values. Missing, failed, nil, restricted or malformed required facts return nil with a reason. No creature enumeration, translated caption comparison or longterm cache is added.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMPlatform | Rotation Master platform adapter (implicit with colon calls). |
unit | string | Readable nonempty selected unit token, passed unchanged as the single argument to existence and creature metadata queries. |
Returns
| 1 | number | boolean | nil | Finite native creature ID, false for known unit absence, or nil when required observations are unavailable. |
|---|---|---|
| 2 | string | nil | Policy, query-validation or required-observation availability reason for a nil ID. |
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 | |||||
|---|---|---|---|---|---|
UnitCreatureType | |||||
UnitExists | |||||
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 id = addon.Platform:GetUnitCreatureTypeID("target")
if id == nil then return nil end
-- false (no target) never equals 6, the Undead creature type.
return id == 6Source
Platform/creature_type.lua, line 17. Read only in game; Duplicate makes an editable copy.
Platform.creature_type.GetUnitCreatureTypeID(self, unit)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
if not self:CanReadValue(unit) then return nil,'restricted-value' end
if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
if type(UnitExists)~='function' then return nil,'missing-api' end
local existsOk,exists=pcall(UnitExists,unit)
if not existsOk 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
if not exists then return false end
local native=UnitCreatureType
if type(native)~='function' then return nil,'missing-api' end
local observed,_,id=pcall(native,unit)
if not observed then return nil,'api-error' end
if not self:CanReadValue(id) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(id) then return nil,'restricted-value' end
if id==nil then return nil,'unit-creature-type-unavailable' end
if type(id)~='number' or id~=id or id==math.huge or id==-math.huge then return nil,'invalid-api-result' end
return id




