GetSpellLink

Returns a hyperlink for a spell.

link, spellID = GetSpellLink(spellID or spellName)
              = GetSpellLink(slot, bookType)

Arguments

spellID 
number - ID of the spell. Provided the spellId is valid, this will return the spell link even if the player character doesn't know this spell.
spellName 
string - Localized name of the spell. Requires the player character to know this spell.

slot 
number - Valid values are 1 through total number of spells in the spellbook on all pages and all tabs, ignoring empty slots.
bookType 
string - BOOKTYPE_SPELL or BOOKTYPE_PET depending on if you wish to query the player or pet spellbook. Internally the game only tests if this value is equal to "pet" and treats any other string value as "spell"
BOOKTYPE
Constant Value Description
BOOKTYPE_SPELL "spell" The General, Class, Specs and Professions tabs
BOOKTYPE_PET "pet" The Pet tab

Returns

link 
string : spellLink
spellID 
number

Examples

Prints a clickable spell link for Flash Heal.

/run print(GetSpellLink(2061))

Dumps the (escaped) spell link.

/dump GetSpellLink(2061)
"|cff71d5ff|Hspell:2061:0|h[Flash Heal]|h|r", 2061

Dumps the first spell from your spell book.

/dump GetSpellLink(1, BOOKTYPE_SPELL)
"|cff71d5ff|Hspell:6603:0|h[Auto Attack]|h|r", 6603

Patch changes

Community content is available under CC BY-SA 3.0 unless otherwise noted.