View Single Post
04/30/20, 04:03 AM   #11
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Code:
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:12: attempt to index a nil value
-> Error in line 12 of your file /AddOns/RemiCustomAddon/RemiCustomAddon.lua

Code:
stack traceback:
-> Shows you what was called until the error in line 12 appeared (read it from bottom to top -> a stack).

Code:
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:12: in function 'RemiCustomAddon:RestorePositionBagSpace'

|caaaaaa<Locals> self = [table:1]{inCombat = F, name = "RemiCustomAddon"} </Locals>|r
-> <Locals> Shows you the local variables that existes + their contents, as the error ocured. Either your addon's variables and contents, or ZOs vanila code, or both. Function parameters, tables {...} etc.
e.g.

self = [table:1]{} means self is the first table in the stack traceback and the string between {} is the content of the table.
It got a variable inCombat and name

inCombat is a variable of your addon's table, which you point to with the self variable. It shows the current value = F (false) / T (true).
You can see from that code that in your function RemiCustomAddon:Initialize the variable self.inCombat is false and the self.name "RemiCustomAddon"

Code:
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:34: in function 'RemiCustomAddon:Initialize'

|caaaaaa<Locals> self = [table:1] </Locals>|r
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:77: in function 'RemiCustomAddon.OnAddOnLoaded'
|caaaaaa<Locals> event = 65536, addonName = "RemiCustomAddon" </Locals>|r

About LibDebugLogger:
It basically shows the same as the stack trace back above. It only provides a cleaner view of the variables.
You can watch the source code you have posted at your LibDebugLogger link. The red lien with the error message. Click it and below you'll see the local variables as parsed "clean view" or raw (like within the error message).


I can see you are using several addons, like HarvestMap and others.
For the test of your addon you should always disable all other addons and not needed libraries. Reloadui will be much faster then and you can test if your addon alone works, or not.

You can use Circonians Addon Selector to create a "addon test" profile and "normal profile" so you are able to switch quickly e.g.


Error reason
The error happens as your control is NIL: RemiCustomAddonIndicator
As the addon tries to access it in the event_add_on_loaded callback function Initialize via your call to RestorePositionBagSpace.

Try to move the calls from the initialize function, to RestorePositionBagSpace and RestorePositionCombat to the event_player_activated callback function!

It's called later as the chat is ready and all addons were loaded. Event_add_on_loaded also triggers before the UI is ready and might be the problem with the XML control not properly created yet.

The benefit: Event_player_activated also fires after a zone change e.g. and would reposition and update the labels.

If it also shows an error at event_player_activated your XML might be wrong somehow. Not seeing where though.

Edit2
Think I found somehting in your XML file:

Code:
<OnInitialized>
          -- LUA code here. This is where you'd check to see if the control needs to be hidden or not.
          RemiCustomAddonIndicator:SetHidden(not (GetNumBagFreeSlots(1) < 10))
      </OnInitialized>
Try to change RemiCustomAddonIndicator to self!

Last edited by Baertram : 04/30/20 at 04:23 AM.
  Reply With Quote