Type Function Object GroupObject Library display.* Return value DisplayObject Revision Release 2021.3642 Keywords remove, remove child See also object:removeSelf() display.remove() Group Programming (guide)
Remove an object from a group by either an index number or a reference to the object.
Using this method will delete the specified child object, not simply remove it from the group. If you want to remove an object from a group, insert it into a different group, or insert it into the global stage group instead.
When an object is removed, the
nil and all properties relating to display object are removed. Thus, if there are still references to object in Lua, they will simply be references to a normal Lua table.
object:remove( indexOrChild )
-- Remove the second object from the group display.getCurrentStage():remove( 2 )