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
end

Timer:Start(iDueTime, iPeriod, sFunctionName)

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

Parameters:

Timer:Stop()

This function stops the timer.

Hex Script versions < 1.2.0.1:
This function does not return a value
Hex Script versions >= 1.2.0.1:
This function returns false on error, and true on success.

Timer:GetId()

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
end

Generated on Sat Aug 22 21:09:31 2009 for Hex Script by  doxygen 1.5.8