XML virtual object
Is it possbile to only create a virtual object if it's does not exists with that global name?
|
Quote:
Unless you mean you want to create a virtual object with a name that already exists as a global? If you try to create a new virtual object by reusing a global name of another virtual object then it will not override it, instead the new virtual object you are trying to create will just be ignored. If the global name you are using for this new virtual object is already defined but is not associated to another virtual object then this is fine. |
Quote:
|
Quote:
In the .toc I had 3 files in this order of execution: test1.lua test2.xml test3.lua test1.lua had this: Lua Code:
test2.lua had this: XML Code:
test3.lua had this: Lua Code:
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) |
Then it's definately stored in another global like table, would be nice to know it's name if it's accessible for lua.
|
To my knowledge, the Lua environment doesn't know anything about virtual objects.
|
Quote:
|
Quote:
|
I think you get an error if you try to create a frame using a non existing template. Could use that maybe. Won't be a pretty solution probably.
|
All times are GMT -6. The time now is 02:45 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI