1,314
edits
| Line 247: | Line 247: | ||
<syntaxhighlight lang="nasal"> | <syntaxhighlight lang="nasal"> | ||
var | var loopExample = func { | ||
if ( | if (someCondition) { | ||
timer.restart(0.1); # Adjust the timer frequency (ms) | |||
} | } | ||
if (finished) { | if (finished) { | ||
timer.stop(); # Cancel the timer. Timer can be started again later. | |||
} | } | ||
}; | }; | ||
var timer = maketimer(0.25, loopExample); | |||
timer.simulatedTime = 1; # Use simulated time, as maketimer defaults to using wallclock time and continues during pause. | |||
timer.start(); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
edits