View Single Post
09/14/16, 11:01 PM   #3
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
Originally Posted by ArtOfShred View Post
However when I attempt to reference the values in the list I'm getting an error that it's returning a nil value for each of these lines:
iconName = FakeBuffs[abilityId].icon
effectName = FakeBuffs[abilityId].name
duration = FakeBuffs[abilityId].duration
I'm pretty new to LUA: Am I just messing up the syntax here or misunderstanding it entirely?
What's most likely happening is that FakeBuffs[abilityId] doesn't exist. So then on those particular lines it tries to dereference nil.

You need something more like:

Lua Code:
  1. function SCB.OnCombatEvent( ... )
  2.     if FakeBuffs[abilityId] ~= nil then
  3.         iconName = FakeBuffs[abilityId].icon
  4.         effectName = FakeBuffs[abilityId].name
  5.         duration = FakeBuffs[abilityId].duration
  6.  
  7.         ...
  8.     end
  9. end

PS - use the Lua BBCode when posting code snippets -- not screenshots
  Reply With Quote