Type Number Object GroupObject Library display.* Revision Release 2024.3703 Keywords group children, child count, group count See also Group Programming (guide)
Retrieve the number of children in a group. You access the children by integer (whole number) index.
local group = display.newGroup() group:insert( rect1 ) -- assume rect1 is an existing display object group:insert( rect2 ) -- assume rect2 is an existing display object for i=1,group.numChildren do local child = group[i] local description = (child.isVisible and "visible") or "not visible" print( "child["..i.."] is " .. description ) end