Thread Tools Display Modes
08-04-05, 06:05 AM   #1
rizean
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Aug 2005
Posts: 3
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
  Reply With Quote
08-09-05, 07:48 AM   #2
Cladhaire
Salad!
 
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
I answered this one on the WoW forums... afaik. Lemme know if you're still having issues with it.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Need help with Table Bug

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off