Thread: Global vars ?
View Single Post
11-04-14, 12:49 PM   #32
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
I'm popping in here just to tell AlleyKat, no. Just... no. Bad kat. Bad.
No separating frame userdata from their tables.

All joking aside. From the tests I did on widget objects and their data structure, it's a really bad idea to mess with the userdata placed in the created table. Even though the frame methods receive the table itself and do their own indexing operations to reference the userdata, the callback scripts get their own table reference self from C code that points to the original table created for that frame. With all the hacks needed to make a table transplant work on widget objects, it causes a major performance hit when trying to index the frame from a script. It's much better to just store the frame in your addon table than trying to transplant its innards.

Like this:
Code:
local name,addon=...;
addon.Events=CreateFrame("Frame");
__________________
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)

Last edited by SDPhantom : 11-04-14 at 12:54 PM.
  Reply With Quote