about a Create functions and new instances of objects
For example:
frame1 = CreateFrame("frame","frame1",UIParent) frame2 = CreateFrame("frame","frame1",UIParent) frame1 == frame2 ? or frame2 is new widget object? If second is right then i have a new snippet for optimize all addons lua Code:
|
Lua Code:
That said, this snippet is not found in your code block. Lua Code:
I have no idea what you are trying to accomplish with this, though. Either I am missing something or your code does nothing that the default UI doesn't already do, except you are adding another complicated layer on top of it... Well, other than not creating any frames if that name already existed... |
Quote:
Code:
f1=CreateFrame("Frame","f0"); Quote:
|
but when i create frames as local - creates one widget or two and stores first in global table and rewtiting by second CreateFrame?
local frame1 = CreateFrame("frame","frame1",UIParent) local frame2 = CreateFrame("frame","frame1",UIParent) my snippet should return frame if that existed in _G and return new frame if not exist (by name) upd. exept secured frames :( |
Quote:
Code:
print(frame1 == frame2) Code:
t1 = {} Also, your code is a terrible idea. If a frame already exists named "MyTestFrame" and I run this code: Code:
local frame = CreateFrame("Frame", "MyTestFrame") Also, your code does not take into account that global variables can contain any type of data. For example, if I try to create a frame whose global name is "ABANDON_QUEST": Code:
local frame = CreateFrame("Button", "ABANDON_QUEST", UIParent, "UIPanelButtonTemplate") Your code does not optimize anything. It adds complexity, adds overhead, and would make it much more difficult to identify the cause of any naming conflicts. |
Quote:
The above code actually works. Did you instead mean this, Phanx? Code:
local frame = CreateFrame("Button", "ABANDON_QUEST", UIParent, "UIPanelButtonTemplate") |
Quote:
|
That's sad :(
We really need garbage collector, came across this quite often, for example in addon kCore But it was the first attempt. At least we can determine the type of data and etc. |
Quote:
|
Quote:
that the "above" code which I quoted from you (local frame) actually works, that the "below" code which I posted myself (ABANDON_QUEST) doesn't work. not the other way round I can't reread the OP's posts. It just isn't legible imo >.< |
Quote:
|
Yes, if you're not reading the OP's code, then probably nothing else in this thread is going to make any sense to you. Everything in my post was about what would happen if the OP's code were in use. :rolleyes:
|
Quote:
Quote:
Quote:
|
All times are GMT -6. The time now is 09:27 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI