RealSignal

RealSignal.Connect

Connects a callback to a RealSignal and returns a RealSignalConnection.

構文

RealSignal.Connect(signal: RealSignal, callback: (....any) -> ()): RealSignalConnection

引数

名前説明
signalRealSignalSignal object returned by Signal.new.
callback(....any) -> ()Function called whenever the signal is fired while the connection remains connected.

戻り値

名前説明
connectionRealSignalConnectionConnection object with Disconnect.

説明

Connects a callback to a RealSignal and returns a RealSignalConnection. The callback receives the arguments passed to Fire.

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

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

Connect a callback and disconnect it when it is no longer needed.

local signal = Signal.new()

local connection = signal:Connect(function(value)
    print(value)
end)

signal:Fire(1)
connection:Disconnect()

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.

RealSignalConnection

Connection object returned by RealSignal.Connect and RealSignal.Once.

Disconnect () -> () Disconnects the connection.