Thread Tools Display Modes
Prev Previous Post   Next Post Next
01/09/22, 06:38 PM   #1
olongjohnson
Join Date: Dec 2021
Posts: 3
Question attempt to index a nil value - following tutorial issue

Okay I am completely new and have probably a total brain fart mistake here, but I cannot figure out what I'm doing wrong following the tutorial here: https://wiki.esoui.com/Writing_your_first_addon

I am at the point where FooAddon should be outputting to console when I enter and leave combat, but the line self.inCombat = IsUnitInCombat("player") in FooAddon:Initialize() is throwing an error:

user:/AddOns/FooAddon/FooAddon.lua:6: attempt to index a nil value
stack traceback:
user:/AddOns/FooAddon/FooAddon.lua:6: in function 'FooAddon:Initialize'
user:/AddOns/FooAddon/FooAddon.lua:13: in function 'FooAddon.OnAddonLoaded'
<Locals> event = 65536, addonName = "FooAddon" </Locals>

I've checked for typos - to the point of copy pasting in code from the tutorial, but cannot get this solved. I called and saved IsUnitInCombat("player") to a test variable & printed it to console fine on reload, so I'm assuming my 'self.inCombat' initialization is wrong somehow. I tried initializing the inCombat variable earlier/outside of the initialization function for FooAddon, but that didn't work either.

The only thing I can think to go on now is that this error pops up about 10 times at the bottom of my debug log every reload for various addons, seeming to stem from 'Failed to create control 'LibCustomMenuSubmenu'. Duplicate Name.' following that, there's a bunch of following 'attempt to index a nil value' errors. I'll post a screenshot of my logger output & current lua file.
Attached Thumbnails
Click image for larger version

Name:	indexnilLog.PNG
Views:	271
Size:	635.8 KB
ID:	1437  
Attached Files
File Type: lua FooAddon.lua (670 Bytes, 246 views)
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » attempt to index a nil value - following tutorial issue


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