Originally Posted by ChaosInc
frame = "Minimap"
Code:
activeProfile[frame].width = getglobal(frame):GetWidth()
Code:
activeProfile[frame].width = _G[frame]:GetWidth()
_G is new to me, so I'm not exactly sure on what I'm doing here. The first one works, but the second one doesn't. Yet..
Code:
activeProfile[frame].scale = _G[frame]:GetScale()
activeProfile[frame].level = _G[frame]:GetFrameLevel()
activeProfile[frame].strata = _G[frame]:GetFrameStrata()
All work just fine. I'm confused.
|
assuming your frame is created by CreateFrame() (and isn't a string with a misleading name) then you dont need _G[] to get stuff from it. For example with
Code:
local frame = CreateFrame("Frame", "MyTestFrame", UIParent)
you can either do
Code:
activeProfile[frame].scale = frame:GetScale()
or
Code:
activeProfile[frame].scale = MyTestFrame:GetScale()
the first one doesnt need _G[] because it uses a local pointer to the frame you have create, the second doesnt need _G[] because it is using the global name of the frame.
An example of where you would need _G would be
Code:
for i = 1, 5 do
local f= CreateFrame("Frame", "MyTestFrame"..i, UIParent)
end
for i = 1, 5 do
activeProfile[frame..i].scale = _G["MyTestFrame"..i]:GetScale()
end