display.newGroup()

Type Function
Library display.*
Return value GroupObject
Revision Release 2024.3703
Keywords groups, objects, grouping
See also Group Programming (guide)

Overview

Creates a display group for organizing/layering display objects. Initially, there are no children in a group. The local origin is at the parent's origin; the anchor point is initialized to this local origin.

See the Group Programming guide for more information.

Gotchas

Using groups with the physics engine has some limitations — see the Physics Notes/Limitations guide.

Syntax

display.newGroup()

Example

-- Create a rectangle and a group, then insert the rectangle into the group
local rect = display.newRect( 0, 0, 100, 100 )
rect:setFillColor( 0.5 )

local group = display.newGroup()
group:insert( rect )