Why window.set_listener works just one at a time?

Hello again :sweat_smile:

It took me a while until I found out a bug in my project that I wasn’t aware of. If I have 2 scripts in, at least, the same collection, with window.set_listener only one would work. This is a test to reproduce it:
listener-test.zip (150.4 KB)

I just want it to understand why is that. Just out of curiosity. I didn’t find any limitation in docs. Could anybody help me to make my mind around this? Thank you very much.

Hi!
The limitation is implied by the word “set” ( as opposed to for example “add”).

The reasoning is that you only really need one, as you can already easily do whatever you wish in that that callback. For instance, store the values in a Lua module, or passing them further in a message.

2 Likes

Hi!
That makes all the sense in the world. Thank you for your fast response.