Call as
Conditions.specialization.specName(id)
Record the dependency Conditions.specialization.specName, 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
Names a specialization for SPECIALIZATION descriptions: the platform's display name and icon, else the built-in localized name, else "specialization N". Returns nil when id is not a valid specialization ID.
Arguments
| Name | Type | What it does |
|---|---|---|
id | any | Saved specialization ID. |
Returns
| 1 | string | nil | Specialization name, or nil for an invalid ID. |
|---|---|---|
| 2 | number | string | nil | Icon, only when the platform supplied display data. |
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.
It reads no game API directly.
How the addon calls it
- Specialization (print)
Functions.presentation.nullable((specName(value.spec)), L["<specialization>"])) Conditions.specialization.classChoicesif SPECS[id][1]==class then choices[id]=specName(id);order[#order+1]=id end
Dependencies
SPECS(builtin:Conditions/specialization.lua:SPECS)specID→Conditions.specialization.specID
Source
Conditions/specialization.lua, line 152. Read only in game; Duplicate makes an editable copy.
Conditions.specialization.specName(id)
if not specID(id) then return nil end
local listed=SPECS[id]
if listed and listed[3]=="Initial" then return L["No specialization"] end
local display=addon.Platform.GetSpecializationDisplay and addon.Platform:GetSpecializationDisplay(id)
if display then return display.name,display.icon end
local known=SPECS[id]
if known then return L[known[3]] end
return string.format(L["specialization %d"],id)