Difference between revisions of "timer.start"

From Inspired-Lua Wiki
Jump to navigation Jump to search
Line 22: Line 22:
  
 
== Example ==
 
== Example ==
<source>timer.start(0.5)</source>
+
<source>
 +
variable = 0
 +
 
 +
function on.timer()
 +
  timer.stop()
 +
  variable = variable + 1
 +
  platform.window:invalidate()
 +
end
 +
 
 +
function on.paint(gc)
 +
  timer.start(0.5)
 +
  gc:drawString(variable,0,0,"top")
 +
 
 +
end</source>
  
 
== See also ==
 
== See also ==

Revision as of 18:36, 7 January 2012

timer.start is a function that is part of the timer functions.

Starts the timer with the given period in seconds.
If the timer is already running when this routine is called, the timer is reset to the new period.

This function fires the on.timer() event.


This has been introduced in TI-Nspire OS 3.0 (Changes).


Syntax

timer.start(period)

Parameter Type Description
period
number the time period in seconds for the timer to start. Must be > 0.01

Example

variable = 0

function on.timer()
   timer.stop()
   variable = variable + 1
   platform.window:invalidate()
end

function on.paint(gc)
   timer.start(0.5)
   gc:drawString(variable,0,0,"top")

end

See also