RealSignal

Signal.new

Creates a new RealSignal object.

Cú pháp

Signal.new(): RealSignal

Giá trị trả về

TênKiểuMô tả
signalRealSignalNew signal object with its own connection and waiter lists.

Mô tả

Creates a new RealSignal object. The returned signal exposes Connect, Once, Wait, and Fire methods.

Goi khong can parameter. Function doc context can thiet tu runtime state hien tai.

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

Ví dụ

Create an independent RealSignal and fire it with values.

local signal = Signal.new()

signal:Connect(function(value)
    print(value)
end)

signal:Fire("ready")

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.