display.remove(object) vs object:removeSelf()

Hi,

On doc I find that is faster to use display.remove(object) if we want to verify if the object is not nil but is it faster or the same time if we don’t do the verification.

Does there is another way to remove object?

If we do that:

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

does it replace automaticly when we build by

display.remove(object)

?

Thanks

Rémi

I believe that display.remove() is nothing more than:

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

I’m trying to verify it, but I believe that’s the case.

Rob

display.remove() does a little more than above. First it tests to see if the object exists. Then it checks to see if it has a member named removeSelf() and that it’s a function but for all practical purposes it saves you checking the object before calling removeSelf()

Rob 

Thank you rob!

I believe that display.remove() is nothing more than:

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

I’m trying to verify it, but I believe that’s the case.

Rob

display.remove() does a little more than above. First it tests to see if the object exists. Then it checks to see if it has a member named removeSelf() and that it’s a function but for all practical purposes it saves you checking the object before calling removeSelf()

Rob 

Thank you rob!