-   Lua/XML Help (
-   -   Unexplained ScrollTemplate.lua error... (

Phinix 05/20/20 03:58 PM

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.


local datalist = ZO_ScrollList_GetDataList(ESOMRL_MainFrameListFrameList)
ZO_ScrollList_Commit(ESOMRL_MainFrameListFrameList, datalist)

for i = 1, #SomeTable do
        datalist[i] = ZO_ScrollList_CreateDataEntry( 1,
                RecipeName = SomeTable[i],
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:


<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"/>

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:


[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.

Phinix 05/20/20 08:22 PM

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.

Baertram 05/22/20 03:30 AM

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.

All times are GMT -6. The time now is 11:20 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2014 - 2020 MMOUI