Originally Posted by Resike
I'm pretty sure it's added the the global table, since you can only reach it with that reference. But i could be wrong.
|
I don't think virtual object names are stored in there because I did a test:
In the .toc I had 3 files in this order of execution:
test1.lua
test2.xml
test3.lua
test1.lua had this:
Lua Code:
A_GLOBAL_NAME = "hello";
print(A_GLOBAL_NAME)
test2.lua had this:
XML Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Frame name="A_GLOBAL_NAME" inherits="UIPanelDialogTemplate" virtual="true" />
</Ui>
test3.lua had this:
Lua Code:
print(A_GLOBAL_NAME)
local f = CreateFrame("Frame", nil, UIParent, "A_GLOBAL_NAME")
f:SetSize(500, 500)
f:SetPoint("CENTER", UIParent, "CENTER")
f:Show()
And basically test1.lua printed "hello" and so did test3.lua which means A_GLOBAL_NAME was never overwritten but also the frame inheritted from the virtual object named A_GLOBAL_NAME was successfully displayed as well.
EDIT: I also tried altering the XML virtual objects name to "SOME_OTHER_NAME" and in the test3.lua file I did this:
print(_G["SOME_OTHER_NAME"])
which printed nil so no, its definitely not in the _G table
It would also explain why CreateFrame's 4th argument "template" for example requires the template/virtual object's name to be a string or a comma-separated string list of names. If you do not supply a string and attempt to use the virtual objects name as a global variable instead then the system cannot find the virtual template because it reads this as a nil value. A global variable name is never created for the virtual/template object which is one reason why its efficient. (at least to my understanding)
(It could however be in some sort of sub-table of the global table which I am unaware of)