Multiple Scenes at Same Time Allowed?

I have two unique scenes that I want to execute on the same trigger. It seems that, even if they do both begin execution, only one of them actually finishes and does what I’ve programmed.

FIRST QUESTION: Can two or more distinct scenes use the same trigger to begin execution and run independently of each other?

Presuming that the answer is “yes”, here is more detail about the scenes:

Each one of them runs “immediately” (no delay timers built into the scenes themselves) and has no actual action they take directly. Instead, each of them runs LUA code that is identical in the action I’m performing, but I’m performing the action on two distinct devices and I’m using a call delay within each piece of code that is of different durations.

Scene 1 waits two minutes then calls a function defined inside of if called “eval_light”. Scene 2 waits five minutes and then calls a function defined inside of it called “eval_light”. The scene with the two minute delay works correctly every time. The scene with the five minute delay only works if Scene 1 is not executing during its run.

SECOND QUESTION: Again presuming that I -can- run two distinct scenes in parallel, can I use the same function inside of each scene / LUA code to perform different actions? Or, is this the crux of my problem and I need to use two distinct function names so that they don’t overlap each other?

It is hard to diagnose without seeing the actual code… textual descriptions just do not hack it.

You should be able to do what you want, but, judging from your second question, if your ‘eval_light’ functions are not declared as local within each scene, then one definition will overwrite the other.

As a test, I renamed both of the functions to unique names and they now both work properly. So, it seems that I need some education on defining functions and calling them because they clearly are not “local” (not by default, at least).

No, they are not local by default. Usual practice in Lua would be to define every variable and function that you use as local, unless you really mean them not to be so…

local function fct(a,b)
  local c = a+b
  return c
end

Time to learn Lua a little better…

[ul][li]https://www.lua.org/pil/
[/li]
[li]https://www.lua.org/manual/5.1/
[/li][/ul]