RealSignal

RealSignal.Wait

Yields the current thread until the RealSignal is fired, then resumes with the arguments passed to Fire.

構文

RealSignal.Wait(signal: RealSignal): ....any

引数

名前説明
signalRealSignalSignal object returned by Signal.new.

戻り値

名前説明
...values....anyAll values passed to the Fire call that resumed the waiter.

説明

Yields the current thread until the RealSignal is fired, then resumes with the arguments passed to Fire. It errors when called from a context that cannot yield.

1 個のパラメータで呼び出します: signal。引数表では必須値と動作を調整する値を確認できます。

...values (....any) を返します。戻り値表を使って成功値、nil 結果、回復可能なエラーを分けて扱ってください。

Yield until the signal fires and receive the fired values.

local signal = Signal.new()

task.spawn(function()
    task.wait(1)
    signal:Fire("done", 2)
end)

local status, count = signal:Wait()
print(status, count)

RealSignal

Signal object returned by Signal.new.

Connect (callback: (...any) -> ()) -> RealSignalConnection Adds a callback that runs when Fire is called.Once (callback: (...any) -> ()) -> RealSignalConnection Adds a callback that is disconnected before its first callback invocation.Wait () -> ...any Yields until Fire resumes the waiter with the fired values.Fire (...values: any) -> () Runs connected callbacks and resumes waiters with the provided values.