Reference › Function reference › Conditions

Conditions.specialization.playerClass

dependency

Call as

Conditions.specialization.playerClass()

Record the dependency Conditions.specialization.playerClass, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.

What it does

Returns the player's class file token (such as "MAGE") from UnitClass, or nil when the call fails or the value is restricted.

Arguments

None.

Returns

1string | nilClass file token, or nil when unavailable.

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 APIClassic EraTBC AnniversaryClassic progressionForeverRetail
UnitClassClassic EraTBC AnniversaryClassic progressionForeverRetail

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.

How the addon calls it

Source

Conditions/specialization.lua, line 165. Read only in game; Duplicate makes an editable copy.

Conditions.specialization.playerClass()
    local ok,_,class=pcall(UnitClass,"player")
    if ok and addon.Platform:CanReadValue(class) and type(class)=="string" then return class end

Back to Function reference