Timer class

The Timer class represents a Windows APC Timer.
Hex.Timer() returns a new object of type Timer.

The timercallback is executed as an asynchronous procedure call, and therefore should be used only for short tasks or it could affect other timer operations.
The Timer is only active while the Timer object is valid. Once the lua garbage collector collects the timer will be removed.
You should always avoid the use of timers where you can.

Timer callback function

This function will be called when ever the timer interval elapsed.
You can use whatever name you wishes for the timer callback.
function MyTimerProc(iTimerId)
	-- the timer period has elapsed

Timer:Start(iDueTime, iPeriod, sFunctionName)

This function starts the timer. It returns true on success and false on error



This function stops the timer.


This function returns the timers identifier or 0 (zero) if the timer is not active.

Lua sample code

mytimer = Hex.Timer()
-- Interval of timer = 10 sec
mytimer:Start(10000, 10000, "MyTimerProc")

function MyTimerProc(iTimerId)
	-- the timer period has elapsed

Generated on Thu Aug 21 11:24:07 2008 for HeXHub/HexScript by  doxygen 1.5.4
Site hosted by SourceForge.net Logo