Type Function Object GroupObject Library display.* Return value none Revision 2017.3110 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 rendering-related resources of the removed object are deleted immediately. What remains of object is simply a plain Lua table with all non-display object properties (the metatable is set to 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 )
display.getCurrentStage():remove( 2 ) -- Removes the second object from the group