문법
RealSignal.Once(signal: RealSignal, callback: (....any) -> ()): RealSignalConnection인수
| 이름 | 타입 | 설명 |
|---|---|---|
signal | RealSignal | Signal object returned by Signal.new. |
callback | (....any) -> () | Function called at most once for this connection. |
반환값
| 이름 | 타입 | 설명 |
|---|---|---|
connection | RealSignalConnection | Connection object with Disconnect. |
설명
Connects a callback that is disconnected before its first callback invocation. The callback receives the arguments passed to Fire.
2개 파라미터로 호출합니다: signal, callback. 인수 표는 필수 값과 동작을 조정하는 값을 설명합니다.
connection (RealSignalConnection)을 반환합니다. 반환 표를 사용해 성공 값, nil 결과, 복구 가능한 오류를 구분하세요.
예제
Connect a callback that runs at most once.
local signal = Signal.new()
signal:Once(function(value)
print(value)
end)
signal:Fire("first")
signal:Fire("second")타입
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.