View Single Post
08-28-20, 08:00 PM   #14
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Walkerbo View Post
Lua Code:
  1. local framesNbuttons = {frameA, frameB, buttonA, buttonB}
  2.  
  3. framesNbuttons.frameA = CreateFrame("Frame")
  4.  
  5. framesNbuttons.buttonA = CreateFrame("Button")
That doesn't do exactly what you think it does. Your code is creating a table that looks like this:
Lua Code:
  1. local framesNbuttons = {
  2.      [1] = frameA,
  3.      [2] = frameB,
  4.      [3] = buttonA,
  5.      [4] = buttonB,
  6.      ["frameA"] = <yourframe>,
  7.      ["buttonA"] = <yourbutton>,
  8. }
Of course, since frameA, frameB, ... are nil at the time of declaring your table, they aren't actually stored in it and those four numerical keys are tossed at the next garbage collection. So... pointless, really.

Just do:
Lua Code:
  1. local framesNbuttons = {}
  2. framesNbuttons.frameA = CreateFrame("Frame")
  3. framesNbuttons.buttonA = CreateFrame("Button")
__________________
"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

  Reply With Quote