View Single Post
10/01/14, 06:11 PM   #4
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
What are you trying to do?

Actually putting something into the dataControl.data doesn't do anything by itself. If you look, the 'researchAssistant' field is not actually read out. The actual controls are created alongside it within the AddResearchIndicatorToSlot function. As such, I don't think there's really a restriction on subtables.

The NIL indicator you get seems to indicate that whatever you put there isn't sticking around for when you need it. Depending on the ZOS control, the dataControl.data can be overwritten for a list refresh or a sort. As such, you'd need to hook into the callback creation of the dataControl and make sure that for each object created, your structure is there. researchAssistant does this with:
Lua Code:
  1. local hookedFunctions = DECONSTRUCTION.dataTypes[1].setupCallback
  2. DECONSTRUCTION.dataTypes[1].setupCallback = function(rowControl, slot)
  3.     hookedFunctions(rowControl, slot)
  4.     AddResearchIndicatorToSlot(rowControl)
  5. end
(which is essentially doing a posthook on the setupCallback). Before data can be added to one of the ZOS lists, each dataType must be registered with (among other things) a callback. That callback is created whenever an item is to be added to make sure the dataControl.data is setup properly.

If you need something to stick around between those refreshes, put it in a local table for your addon.

Last edited by Sasky : 10/02/14 at 10:31 PM. Reason: fix to posthook
  Reply With Quote