View Single Post
05/20/20, 03:58 PM   #1
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
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.
  Reply With Quote