Luup code in scenes

I’ve created a scene with a trigger. Both the scene and the trigger only have Luup code associated with them.

When the trigger is “triggered”, the Luup code of the scene as well as the Luup code of the trigger is run. Is this supposed to happen? Is there a way to only have the trigger’s Luup code run? If not, what is the best way around this: creating a second scene?

cheers,
J.

There’s a picture near the top of this page on the wiki that shows how scene Luup code fragments tie together. The trigger code always runs. If the trigger code returns true, the scene code runs.

You can mess about with setting global variables in one fragment and testing them in the other, if you want to conditionally not run pieces of code.

Very helpful, thank you!

My use case was the following:
When triggered, run the trigger code, but DO NOT run the scene’s code.

With your suggestion, I simply added “return false” to the end of the trigger code… this prevented the main scene’s code from executing; as required!

cheers,
J.