coroutine

thread coroutine.create ( function f )

関数fを基にthreadを作る。

bool,Variant coroutine.resume (thr,f_v1,f_v2,... )

thrの開始、あるいは再開をさせる。f_v1...はthr内のf本体の引数。
yieldで一時停止した、またはreturn等でthrが終了した場合、trueと返り値を返す。
thrがエラーを起こした時、エラーとともにfalseを返す。

thread,bool,Variant coroutine.wrap (f)

関数fを基にthreadを作り、そのまま開始させる。
yieldで一時停止した、またはreturn等でthrが終了した場合、trueと返り値を返す。
thrがエラーを起こした時、エラーとともにfalseを返す。

*

thread,thread,... coroutine.running ( )

現在動いているthreadを全て返す。

string coroutine.status (thr)

thrの状態を返す。
"running" 現在進行中
"suspended" 一時停止中/未再生
"normal" 使用可能だが進行していない
"dead" 使用不能/エラー落ち

Variant,Variant,... coroutine.yield (val1,val2,val3,...)

これが使用されたcoroutineを一時停止して、引数を返り値として返す。

タグ:

coroutine 索引
最終更新:2020年08月27日 13:28