View Single Post
12-16-16, 12:13 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
TrackerMeta only stores your API functions for the tracker objects. It doesn't store any data at all. When an addon wants to interact with your library, it calls the generator function, :NewTracker(). This returns an empty table used to store the unit data and TrackerMeta attaches its functions to the new table so they can be run on it.

MasterList allows central access and synchronization of all unit data. When an addon registers a unit, if it sees the unit already tracked, it grabs a pointer to the existing unit table. If there isn't one, it's created and stored both in the addon's own table and MasterList. This method also allows the library to update info directly to MasterList and the changes propagate to the individual addon tables as well.

A beneficial side effect of this method is it's entirely self-cleaning. If a tracker object gets released to the GarbageCollector, it starts a cascading effect where it acts as if the addon unregistered all of its units.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote