removing object problem..

removing object problem…

sometimes i try 2 remove existing object.

but theres an error…

‘removeself’ is a(Nil Value)…

how come?

if the object i try 2 remove are existing…

You are probably trying to remove an object that has already been removed or doesn’t exist.

you can do this:

if object then      object:removeSelf()      object=nil end

or use:

display.remove ( object ) object=nil  

which is a convenience call basically doing the same thing.

Or it could be because your error message has a case error:

removeself

should be

removeSelf

thank you for this idea ser…

if object then
     object:removeSelf()
     object=nil
end

or

display.remove ( object )
object=nil

its work :slight_smile:

You are probably trying to remove an object that has already been removed or doesn’t exist.

you can do this:

if object then      object:removeSelf()      object=nil end

or use:

display.remove ( object ) object=nil  

which is a convenience call basically doing the same thing.

Or it could be because your error message has a case error:

removeself

should be

removeSelf

thank you for this idea ser…

if object then
     object:removeSelf()
     object=nil
end

or

display.remove ( object )
object=nil

its work :slight_smile: