how to test a display object for absence from a specific group?

How do I test for the absence of a display object from a group?

I tried what I thought was obvious:

local rect = display.newRect(0, 0, 100, 100)  
local tmpGroup = display.newGroup()  
  
if not rect.parent == tmpGroup then  
 print ("not there yet")  
else  
 print("in there")  
end  

but no. This prints “in there” when it should not.

Maybe something I haven’t yet figured out about Lua, although my extensive (24 hour :slight_smile: experience with that language makes me doubt that?

A Corona bug? or an inconsistency?

Thanks
Alex
[import]uid: 3473 topic_id: 2275 reply_id: 302275[/import]

Try this

[lua]if rect.parent ~= tmpGroup then[/lua] [import]uid: 5712 topic_id: 2275 reply_id: 6866[/import]

Lua’s negation of equality operator. In section 3.2 of the 1st (online) edition. Argh.

Thanks!
Alex
[import]uid: 3473 topic_id: 2275 reply_id: 6869[/import]