Hi Bluesixty,
If the frame has a global name, you can look for that:
Code:
CreateFrame( "Frame", "MyGlobalFrame", UIParent )
if MyGlobalFrame then
print( "Frame exists!" )
end
But, if you only need the frame inside your own code, and don’t need it to be accessible from outside, it’s better not to add it to the global namespace. Something like this would be a good solution:
Code:
local frame
local function InitializeFrame()
if not frame then
frame = CreateFrame( "Frame", nil, UIParent )
-- set up the frame here
end
return frame
end
And then when you want to do something with the frame:
Code:
frame = frame or InitializeFrame()
frame:Show()