I have several scenes which execute lua code. It is important that they are not running at the same time but in serial order.
For this I use a variable “in_use” and a retry function which tries again for a limited amount of times.
It works perfectly in terms that it doesn’t run if another one is running but the retry function doesn’t work. Can someone please give me a hint why?
Thanks
function check()
local in_use = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable3",241)
if in_use == "0"
then
luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable3","1",241)
do_something()
else
if retries > 0
then
retries = retries-1
luup.call_delay( 'check', 10 )
else
return false
end
end
end
local retries = 5
check()