構文
RealSignal.Fire(signal: RealSignal, ...values?: ....any)引数
| 名前 | 型 | 説明 |
|---|---|---|
signal | RealSignal | Signal object returned by Signal.new. |
...values? | ....any | Values forwarded to connected callbacks and waiting threads. |
説明
Fires the RealSignal with zero or more values. Connected callbacks receive those values, once connections are disconnected before invocation, and waiting threads are resumed with the same values. The method returns no values.
2 個のパラメータで呼び出します: signal, ...values。引数表では必須値と動作を調整する値を確認できます。
データは返しません。呼び出しをアクションとして扱い、必要なら呼び出し元でエラーを処理してください。
例
Forward values to connected callbacks and waiting threads.
local signal = Signal.new()
local total = 0
signal:Connect(function(value)
total += value
end)
signal:Fire(5)
print(total)型
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.