The Timer object is used to create delays or trigger events after a defined elapsed time. It should be used instead of Lua’s native delay and time functions. There is no limit to the number of timers you create within a single script (within reason).
Each Timer must be named when created which is then the means by which you manipulate each specific timer. The Timer:Start
method is used to start the timer and set the delay time. When the delay time has elapsed, the function specified in Timer.EventHandler is called. By default, Timer repeats when it has elapsed. Timer.Stop is used to stop the timer. Each Control Script has a single Timer.
Name |
Attribute/Arguments |
Comment |
---|---|---|
Timer.New() |
— |
Creates a new timer object |
.EventHandler |
— |
— |
:Start() |
(period in seconds) |
Starts the timer |
:Stop() |
none |
Stops the timer |
timer1 = Timer.New() timer2 = Timer.New()
function timerFunc(timer)
if timer == timer1 then
print( "timer 1!" )
elseif timer == timer2 then
print ( "timer 2" )
end
end
timer1.EventHandler = timerFunc
timer2.EventHandler = timerFunc
timer1:Start(1)
timer2:Start(2) |
As an alternative to creating a traditional named timer, you can create a simple timer to call a named function after a given delay period. Unlike named timer objects created with Timer.New(), there is no need to issue a :Stop() command to halt repetition of this timer.
Name |
Arguments |
Comment |
---|---|---|
Timer.CallAfter() |
(function, delay time) |
Supply a named function to call after a given delay in [seconds.milliseconds]. |
QSC.com | Software and Firmware | Resources | QSC Self Help Portal
© 2009 - 2018 QSC, LLC. All rights reserved. QSC and the QSC logo are trademarks of QSC, LLC in the U.S. Patent and Trademark office and other countries. All other trademarks are the property of their respective owners.
http://patents.qsc.com