Need help with Table Bug
Ok line 46 is throwing an error when I type /script SBL_test()
Line 46: DEFAULT_CHAT_FRAME:AddMessage('name of rank 5 = ' .. spellArray["Flash Heal"]["Rank 5"])
Error: 46: attempt to concatenate field `Rank 5' (a nil value)
I'm sure it's a simple mistake I am making some where and would be very happy if someone could point it out!
-------------------------------------------------------------------------------
-- here is the global variables, these should not be changed. These basically
-- are the limits of WoW client.
-------------------------------------------------------------------------------
SBL_MAXDEBUFFS = 8;
SBL_MAXBUFFS = 16;
SBL_ACTION_START_SLOT = 1;
SBL_ACTION_END_SLOT = 120;
SBL_PET_SLOTS = 10;
function SpellBookLibary_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage('Rizeans - SpellBook 0.1 Loaded');
-- BuildSpellBook();
SBL_SpellsKnown()
end
function Spells_Changed_OnEvent(event)
if ( event == "SPELLS_CHANGED" ) then
BuildSpellBook();
end
end
spellArray = {};
function SBL_SpellsKnown()
i=1
while true do
SpellInfoName, SpellInfoRank = GetSpellName(i, BOOKTYPE_SPELL);
if not SpellInfoName then
do break end
end
spellArray[SpellInfoName] = {};
spellArray[SpellInfoName][SpellInfoRank] = SpellInfoName .. '(' .. SpellInfoRank .. ')';
if tonumber(string.sub(SpellInfoRank, 6)) ~= nil then
spellArray[SpellInfoName]["Rank"] = tonumber(string.sub(SpellInfoRank, 6));
else
spellArray[SpellInfoName]["Rank"] = SpellInfoRank;
end
i=i+1
end
DEFAULT_CHAT_FRAME:AddMessage('Done')
end
function SBL_test()
DEFAULT_CHAT_FRAME:AddMessage('highest rank = ' .. spellArray["Flash Heal"]["Rank"]);
DEFAULT_CHAT_FRAME:AddMessage('name of rank 5 = ' .. spellArray["Flash Heal"]["Rank 5"])
end
|