説明
The Timer Lua function call a different function using a timer.
The other function can be called multiple times using the timer interval.
引数
- function:
This is the name of the function that is called multiple times using the timer.
- integer:
This is the wait time between the calls. The value is in seconds.
- integer:
This is the number of times the function is called.
- function | nil (オプション):
This is an optional argument that is the name of a function that is called when the Timer function is finished.
- handle (オプション):
This is an optional argument for a handle to an object that is passed to the called function.
戻り値
この関数は何も返しません。
例
This example prints a greeting three times and then calls a clean up function:
|
function TimedFunction() if RunAmount < 1 then Printf("Hello") else Printf("Hello again") end RunAmount = RunAmount + 1 end
function TimerCleanup() Printf("Goodbye") RunAmount = nil end
function Main() local waitSeconds = 1 local iterations = 3 RunAmount = 0 Timer(TimedFunction, waitSeconds, iterations, TimerCleanup); end
return Main
|