WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Need help with Table Bug (https://www.wowinterface.com/forums/showthread.php?t=1433)

rizean 08-04-05 06:05 AM

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

Cladhaire 08-09-05 07:48 AM

I answered this one on the WoW forums... afaik. Lemme know if you're still having issues with it.


All times are GMT -6. The time now is 02:35 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI