RealSignal

RealSignal.Wait

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

Cú pháp

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

Đối số

TênKiểuMô tả
signalRealSignalSignal object returned by Signal.new.

Giá trị trả về

TênKiểuMô tả
...values....anyAll values passed to the Fire call that resumed the waiter.

Mô tả

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.

Goi voi 1 parameter: signal. Bang arguments giai thich gia tri nao bat buoc va gia tri nao chi tinh chinh hanh vi.

Tra ve ...values (....any). Dung bang returns de tach gia tri thanh cong, ket qua nil va loi co the xu ly.

Ví dụ

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)

Kiểu

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.