문법
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.