Different return values for event handler?

My problem is about event propagation. If the event handler ends up with return true at its end, the propagation stops. If return is false, the event is propagated. Now I need an event handler with a variable return value. Within the event handler some conditions are tested and as result the event should be propagated or not.

What I tried is…

if condition then  
 return false  
end  
  
return true  
  
end --of event handler  

But this does not work! I always get a return true. It seems that I cannot break out of the event handling by dynamicly return false (or true).

I want to make an object only moveable by using two finger (multithouch). If the event handler detects only one event, it then should delegate to the scenery. If two fingers move the object, the event must not be propagated.

Any solutions? Thx 4 help. [import]uid: 21703 topic_id: 13949 reply_id: 313949[/import]

You always get a return true because of how it’s set up.

Try this;

[lua]if condition then
return false
else
return true
end
end --of event handler[/lua] [import]uid: 52491 topic_id: 13949 reply_id: 51561[/import]

O-ha… return false does not leave the function!? I thought at the end of a lua block (given here), return does break and return from function by the given value. Otherwise (not at the end of a block) one have to write

do return value end