View Single Post
01-31-12, 12:23 PM   #12
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,333
Originally Posted by Waky View Post
If you're trying to check if another addon's frames have loaded you need to make sure that those frames are visible (aka not local.) If they're global you can access them via the _G.frameName, I believe.
Originally Posted by Torhal View Post
That does, indeed, work; the frame has to be named, however.
To make this more simple, no matter how it's assigned, when a frame is created with a name, the Widget API assigns the frame automatically to a global of the same name.

For example, these will create the global MyFrame.
Code:
CreateFrame("Frame","MyFrame",UIParent);--		Creates the frame and API stores it in the global;
local frame=CreateFrame("Frame","MyFrame",UIParent);--	Creates the frame, API stores it in the global, Lua code keeps a local pointer
MyFrame=CreateFrame("Frame","MyFrame",UIParent);--	Redundant, API stores the frame in the global, Lua code overwrites it with itself
MyFrame=CreateFrame("Frame",nil,UIParent);--		Creates a frame with no name, but Lua code stores it in a global anyway (Same result only MyFrame:GetName() will return nil)
These will not:
Code:
CreateFrame("Frame",nil,UIParent);--			Be careful with this, you create a frame, but have no way of referencing it again
local frame=CreateFrame("Frame",nil,UIParent);--	Creates a frame with no name and only a local pointer is stored
__________________
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