RealSignal

RealSignal.Wait

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

Syntax

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

Argumente

NameTypBeschreibung
signalRealSignalSignal object returned by Signal.new.

Rückgaben

NameTypBeschreibung
...values....anyAll values passed to the Fire call that resumed the waiter.

Beschreibung

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.

Rufe es mit 1 Parameter(n) auf: signal. Die Argumenttabelle erklärt, welche Werte erforderlich sind und welche nur das Verhalten verfeinern.

Es gibt ...values (....any) zurück. Nutze die Rückgabetabelle, um erfolgreiche Werte von nil-Ergebnissen und behandelbaren Fehlern zu trennen.

Beispiel

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)

Typen

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.