Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API GetSpellName

Last wiki revision 2018-05-12

Retrieves the spell name and spell rank for a spell in the player's spellbook.

spellName, spellRank = GetSpellName( spellIdx, "bookType" )

  • spellIdx : Number - Spellbook slot index, ascending from 1 through total number of spells in the spellbook on all pages and all tabs, ignoring empty slots.
  • bookType : String - Either BOOKTYPE_SPELL ("spell") or BOOKTYPE_PET ("pet").
  • spellName : String - Name of the spell as it appears in the spellbook, eg. "Lesser Heal"
  • spellRank : String - The spell rank or type, eg. "Rank 3", "Racial Passive". This can be an empty string. Note: for the Enchanting trade skill at rank Apprentice, the returned string contains a trailing space, ie. "Apprentice ". This might be the case for other trade skills and ranks also.

The following snippet displays every spell in the player's spellbook, on all pages and all tabs, in the format required by CastSpellByName. local i = 1 while true do local spellName, spellRank = GetSpellName(i, BOOKTYPE_SPELL) if not spellName then break end -- use spellName and spellRank here print( spellName .. '(' .. spellRank .. ')' ) i = i + 1 end

  • If you're trying to read the spell book at login, register for the event.
  • From 4.0.1, certain spells will not appear in the player's spell book, such as Track Beasts. As such, they will not be searchable from this function.

Source

https://warcraft.wiki.gg/wiki/API_GetSpellName · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.