View Single Post
11-21-20, 09:00 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
SavedVars should be ready by the time ADDON_LOADED fires. It's part of the addon loading process. The error isn't complaining about the table itself being nil, there's a different error for that. The problem is when you use nil as a key.

The code only works if the opponent has 3 battle pets. If they don't have a full team, this error occurs. One or more empty spots causes species in BattleDex.RecordPet() (along with most of the other arguments) to be nil. This is what the error means by "table index is nil".

Again, if this was a load issue with the SavedVar, this would be "attempt to index nil" instead. It's a common mistake to confuse these two.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote