→ WoW API
Returns the index of the player's current specialization.
currentSpec = GetSpecialization( [ isInspect [, isPet] [, specGroup] ] )
- Boolean - if true, return information for the inspected player
- Boolean - if true, return information for the player's pet.
- Number - The index of a given specialization/talent/glyph group (1 for primary / 2 for secondary).
- Number - index of the current specialization (ascending from 1), or nil if no specialization is currently learned.
The following snippet prints the name of the player's current specialization if you have one selected.
local currentSpec = GetSpecialization() if currentSpec then local _, currentSpecName = GetSpecializationInfo(currentSpec) print("Your current spec:", currentSpecName) else print("You do not currently have a spec.") end
- Despite the argument names, this function does not appear to return valid values for inspected targets; FrameXML uses GetInspectSpecialization("unit") to retrieve a specialization ID instead.