Thread: Global vars ?
View Single Post
11-01-14, 11:27 PM   #7
AlleyKat
A Warpwood Thunder Caller
 
AlleyKat's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 93
Originally Posted by Phanx View Post
This is incorrect for two reasons
No, this way is correct to expose your addon to other addons
local t, n = ...;
MY_ADDON = n;
or

Code:
local t, n = ...;
_G[t] = n;
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 });

Last edited by AlleyKat : 11-01-14 at 11:31 PM.
  Reply With Quote