24.04.2020, 22:09
Hi,
I want to write macro for AV control in lua library so an object can call the function and do a group of things.
when i switch the tv on from off i need to wait 6 sec (time it takes for the tv to start up) before i send it another command
i don't want to have multiple scripts running so don't want to use os.sleep() what is the best way to do this blocking delay?
I want to write macro for AV control in lua library so an object can call the function and do a group of things.
when i switch the tv on from off i need to wait 6 sec (time it takes for the tv to start up) before i send it another command
i don't want to have multiple scripts running so don't want to use os.sleep() what is the best way to do this blocking delay?
Code:
function tv_on()
-- get the state of the tv
local tv_state = get_tv_state() -- returns bool
if tv_state then
-- set to correct input
end
if not tv_state then
-- wait 6 sec then set to correct input
end
end