WoW:API GetSpellTabInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Fixed title.)
m (Move page script moved page API GetSpellTabInfo to WoW:API GetSpellTabInfo without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<center>'''GetSpellTabInfo''' ''-Documentation by Lorrick-''</center>
{{wowapi}}


Returns information about the specified spellbook tab.
Retrieves information about the specified line of spells
name, texture, offset, numSpells = GetSpellTabInfo(spellbookTabNum)


name, texture, offset, numSpells = GetSpellTabInfo({spellbookTabNum});
== Parameters ==


----
<big>'''Arguments'''</big>
;''Arguments''
<!-- List each argument, together with its type -->
:;spellbookTabNum  : Number - The index of the tab, ranges from 1 to MAX_SKILLLINE_TABS


:( spellbookTabNum )


:;spellbookTab : Integer - Spellbook tab to retrieve information for. Valid values are 1 through MAX_SKILLLINE_TABS(8).
<big>'''Returns'''</big>
<!-- List each return value, together with its type -->
:name, texture, offset, numSpells  <!-- remove this line if it's just one value -->


----
:;name : String - The name of the spell line (General, Shadow, Fury, etc.)
;''Returns''
:;texture : String - The texture path for the spell line's icon
:;offset : Number - The number of spells before this spell line (will be one less than the index of the first spell in this spell line)
:;numSpells : Number - The number of spells in this spell line


:<small>Not too familiar with LUA terminology yet so bear with me. Returns 4 values that I could tell.</small>
== Example ==
:name, texture, offset, numSpells
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
:;name : String - Spellbook Tab Name
for i = 1, MAX_SKILLLINE_TABS do
:;texture : String - Spellbook Tab Texture
    local name, texture, offset, numSpells = GetSpellTabInfo(i);
:;offset : Number - Spellbook Tab Offset
   
:;numSpells : Number - Number of spells for this tab.
    if not name then
      break;
    end
   
    for s = offset + 1, offset + numSpells do
      local spell, rank = GetSpellName(s, BOOKTYPE_SPELL);
     
      if rank then
          spell = spell.." "..rank;
      end
     
      DEFAULT_CHAT_FRAME:AddMessage(name..": "..spell);
    end
end


----
[[Category:World of Warcraft API]]
;''Example''
name, texture, offset, numSpells = GetSpellTabInfo(1);
 
;''Result''
 
----
;''Description''
 
: Retreive information for specified spellbook tab.
----
{{Template:WoW API}}
[[Category:API Spell Functions|GetSpellTabInfo]]

Latest revision as of 04:46, 15 August 2023

WoW API < GetSpellTabInfo

Retrieves information about the specified line of spells

name, texture, offset, numSpells = GetSpellTabInfo(spellbookTabNum)

Parameters

Arguments

spellbookTabNum
Number - The index of the tab, ranges from 1 to MAX_SKILLLINE_TABS


Returns

name, texture, offset, numSpells
name
String - The name of the spell line (General, Shadow, Fury, etc.)
texture
String - The texture path for the spell line's icon
offset
Number - The number of spells before this spell line (will be one less than the index of the first spell in this spell line)
numSpells
Number - The number of spells in this spell line

Example

for i = 1, MAX_SKILLLINE_TABS do
   local name, texture, offset, numSpells = GetSpellTabInfo(i);
   
   if not name then
      break;
   end
   
   for s = offset + 1, offset + numSpells do
      local	spell, rank = GetSpellName(s, BOOKTYPE_SPELL);
      
      if rank then
          spell = spell.." "..rank;
      end
      
      DEFAULT_CHAT_FRAME:AddMessage(name..": "..spell);
   end
end