display.remove()

Type Function
Library display.*
Return value none
Revision Release 2024.3703
Keywords removing, deleting, objects
See also object:removeSelf()

Overview

Removes an object or group if not nil.

This is the same as calling object:removeSelf(), but will first check if the object exists before attempting to remove.

Syntax

display.remove( object )
object (required)

DisplayObject. The variable referencing the display object (vector, image, or group) to be removed.

Example

local obj = display.newImage( "image.png" )
obj:translate( 100, 100 )

-- Remove the object
display.remove( obj )
obj = nil