Thread: Global vars ?
View Single Post
11-02-14, 08:28 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by AlleyKat View Post
or my way
Code:
local title, M = ...;
local frame = CreateFrame("Frame", title);
M[0] = frame[0];
	
setmetatable(M, { __index = getmetatable(frame).__index });
setmetatable(frame, { __index = M, __newindex = M });
This is incredibly overcomplicated and pointless... if you want your globally-accessible object to be a frame, just make it a frame, and don't use the private table. The private table is only there so that if you don't want a global, you don't need to make one just to share data between files in your addon.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote