Söz dizimi
RealSignal.Wait(signal: RealSignal): ....anyArgümanlar
| Ad | Tip | Açıklama |
|---|---|---|
signal | RealSignal | Signal object returned by Signal.new. |
Dönüşler
| Ad | Tip | Açıklama |
|---|---|---|
...values | ....any | All values passed to the Fire call that resumed the waiter. |
Açıklama
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.
1 parametre ile cagir: signal. Arguman tablosu hangi degerlerin zorunlu oldugunu ve hangilerinin davranisi incelttigini aciklar.
...values (....any) dondurur. Basarili degerleri, nil sonuclari ve toparlanabilir hatalari ayirmak icin return tablosunu kullan.
Örnek
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)Tipler
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.