Okay, I'm currently experiencing the following error when ingame:
...Addons\WatcherEx\GeminiSpellBook\GeminiSpellBook.lua:91: attempt to index local 'spell' (a nil value)
stack trace:
...Addons\WatcherEx\GeminiSpellBook\GeminiSpellBook.lua:91: in function 'IsStance'
...Addons\WatcherEx\GeminiSpellBook\GeminiSpellBook.lua:132: in function 'GetInnates'
...aming\NCSOFT\WildStar\Addons\WatcherEx\WatcherEx.lua:1868: in function 'UpdateSkillsList'
...aming\NCSOFT\WildStar\Addons\WatcherEx\WatcherEx.lua:1606: in function <...aming\NCSOFT\WildStar\Addons\WatcherEx\WatcherEx.lua:1600>
So I'm using these 2 functions together:
-- Description: Determines whether a given spell ID is a stance or not.
--
-- Parameters: - spell: The Spell object from the game we need to check.
--
-- Returns: True if the ID is that of a stance spell; otherwise false.
--
function GeminiSpellBook:IsStance(spell)
for i,group in ipairs(ctClassStancesAbilities) do
for j, stanceId in pairs(group) do
if spell:GetId() == stanceId then
return true
end
end
end
return false
end
Which is called by the following function:
-- Description: Gets all the Innate abilities for the current character being played and stores
-- them in the internal tInnates structure.
-- The function takes no arguments, but expects a 'self' parameter, so
-- should be called as SpellBook:GetInnates()
--
-- Parameters:
--
-- Returns: The list of Innate abilities.
function GeminiSpellBook:GetInnates()
if self.tInnates == nil or #self.tInnates <= 0 then
self.tInnates = { }
local tSpells = GameLib.GetClassInnateAbilitySpells().tSpells or { }
for _,spell in ipairs(tSpells) do
if spell ~= nil and not self.IsStance(spell) then
table.insert(self.tInnates, spell)
end
end
end
return self.innates
end
I've added a check to see if I was passing a nill value, but still I keep getting the error. The way I interpret is that the passed parameter turns into nil during the function call.
However when I check the data in the console myself, the data is there....
You should change the call from self.IsStance(spell)
to self:IsStance(spell)
or use self.IsStance(self, spell)
. Since you defined IsStance
as the method (using GeminiSpellBook:IsStance
) it gets the first parameter as self
, which is where spell
gets assigned and the spell
parameter you expect gets nil
value, which is causing the error you see.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With