display.newGroup()

Type Function
Library display.*
Return value GroupObject
Revision Current Public Release (2014.2393)
Keywords groups, objects, grouping
See also Group Programming Guide

Overview

Creates a group in which you can add and remove child 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 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 )