説明
Timer 関数は、タイマーを用いて別の関数を呼び出します。他の関数は、タイマー間隔を用いて複数回呼び出せます。
引数
- function:
タイマーを用いて複数回呼び出される関数の名前です。
- 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
|