View Single Post
09-19-19, 10:12 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
GetChildren returns a table of tables because frames are tables.

Lua Code:
  1. local parent = CreateFrame("frame","Foo")
  2. local child1 = CreateFrame("frame","Bar1",parent) -- can also use Foo instead of parent, cannot be a string
  3. local child2 = CreateFrame("frame","Bar2",parent)
  4.  
  5. local children = parent:GetChildren()
  6.  
  7. print( children[1] == child1 ) -- true
  8. print( children[2] == child2 ) -- true
  9. print( children[1] == Bar1 ) -- true
  10. print( children[2] == Bar2 ) -- true
  11.  
  12. local count = 0
  13. for k in ipairs(children) do
  14.     count = count + 1
  15. end

Last edited by Kanegasi : 09-19-19 at 10:14 PM.
  Reply With Quote