Quantcast Unexplained ScrollTemplate.lua error... - ESOUI
Thread Tools Display Modes
05/20/20, 03:58 PM   #1
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Unexplained ScrollTemplate.lua error...

It seems this may be a case of something in no way related to scroll lists whatsoever somehow causing this behavior miles down the road, but I am at the end of things to try in troubleshooting this and would appreciate if someone with knowledge of the UI could shed light on what might generate such an error.

Basically I am building a data list for ZO_ScrollList just like I have done a hundred times before.

Code:
local datalist = ZO_ScrollList_GetDataList(ESOMRL_MainFrameListFrameList)
ZO_ScrollList_Clear(ESOMRL_MainFrameListFrameList)
ZO_ScrollList_Commit(ESOMRL_MainFrameListFrameList, datalist)

for i = 1, #SomeTable do
	datalist[i] = ZO_ScrollList_CreateDataEntry( 1, 
	{
		RecipeName = SomeTable[i],
	}
	)
end
ZO_ScrollList_Commit(ESOMRL_MainFrameListFrameList, datalist)

The scroll list itself is defined in XML the same way it has been for years in this addon:

Code:
<Control name="$(parent)List" inherits="ZO_ScrollList">
	<Dimensions x="555" y="534"/>
	<Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT"/>
	<Anchor point="TOPRIGHT" relativeTo="$(parent)" relativePoint="TOPRIGHT"/>
	<Controls>
	</Controls>
</Control>
Suddenly out of the blue I am getting this error when running the above:

EsoUI/Libraries/ZO_Templates/ScrollTemplates.lua:2277: attempt to index a nil value
Looking at the stack trace it basically references the line in the code that calls the above ZO_ScrollList_Commit with no other helpful information.

I used Zgoo.CommandHandler(datalist) in the section of code just before the commit to see what is ending up in datalist and all the data is there in the format:

Code:
[1] = {
	data = (table)...
	typeId = n
}
So that all seems fine.

If I type /script d(ZO_ScrollList_GetDataList(ESOMRL_MainFrameListFrameList)) in chat after the error complaining the table is nil it prints the entire data table to chat, which also appears to all be there.

At this point I have no idea what has gone wrong as I have changed nothing with this section of code and the other changes I have made which I verified using a diff program should not effect this. I even reverted all changes and still get this totally bizarre error.
__________________
My Addons: ESO Master Recipe List - SALTI - Dungeon Tracker - EZReport - Poison Master - Vampire's Woe - Chat Window Manager ... (more)
Also co-author for: Azurah - Srendarr - Show Motifs

PC NA @IllusoryID
  Reply With Quote
05/20/20, 08:22 PM   #2
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
So as I figured this was actually one of those weird unrelated type of things.

Basically I have a global function that handles all the calls from XML for things like buttons in my app, and translates those function calls to various processes in the LUA part of the addon. Anyway I had apparently added an if check for an init variable being set on that global function, and it prevented the XML from properly registering their callbacks or otherwise functioning properly.

Stuff LOOKED like it was being sent, but even with the variable on it still wasn't going through properly. Removing the if check fixed it, though I can't say I entirely understand why.
__________________
My Addons: ESO Master Recipe List - SALTI - Dungeon Tracker - EZReport - Poison Master - Vampire's Woe - Chat Window Manager ... (more)
Also co-author for: Azurah - Srendarr - Show Motifs

PC NA @IllusoryID
  Reply With Quote
05/22/20, 03:30 AM   #3
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,950
Just an idea, nothing I have tested. And maybe not working as I hope it would:
Try LibDebugLogger and DebugLogViewer with the same code.
Enable in the addon settings of DebugLogViewer -> LibDebugLogger submenu -> Stack traceback.
Test if the error message shown in the DebugLogViewer UI will show the traceback stack (if clicked) up to your "if" function line in your code.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Unexplained ScrollTemplate.lua error...

Thread Tools
Display Modes

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