View Single Post
04-18-12, 01:00 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Lua Code:
  1. frame1 = CreateFrame("frame","frame1",UIParent)
  2. frame2 = CreateFrame("frame","frame1",UIParent)
This creates 2 frames. The first is referenced by the global variable frame1 while the second is referenced by two global variables, frame1 and frame2. While the second frame's frame1 reference overwrites the first frame's reference, that does not mean that the second frame replaces the first. They both still exist.

That said, this snippet is not found in your code block.



Lua Code:
  1. if _G[name] ~= nil then
  2.         frame = _G[name]
  3.     else
  4.         frame = oldCreateFrame(ftype, name, ...)
  5.     end
This just says that if the variable name we want to call our frame already exists in the gobal table (which most frames should not be named globally anyway) then assign this frame to the variable frame and... just pass it through the function, replacing some of its methods. The replaced methods do the exact same thing. If there was no frame (or widget) with that global name before, then... just create it as normal. Nothing is changed, except you're replacing the functions with copies of what they originally were.

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...
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh


Last edited by Seerah : 04-18-12 at 01:02 PM.
  Reply With Quote