Đối số
RealSignal
bắt buộc
Signal object returned by Signal.new.
(....any) -> ()
bắt buộc
Function called whenever the signal is fired while the connection remains connected.
Giá trị trả về
RealSignalConnection
Connection object with Disconnect.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Connects a callback to a RealSignal and returns a RealSignalConnection. The callback receives the arguments passed to Fire.
RealSignal.Connect(signal: RealSignal, callback: (....any) -> ()): RealSignalConnection
| Name | Type | Required | Mô tả |
|---|---|---|---|
Connect | (callback: (...any) -> ()) -> RealSignalConnection | Yes | Adds a callback that runs when Fire is called. |
Once | (callback: (...any) -> ()) -> RealSignalConnection | Yes | Adds a callback that is disconnected before its first callback invocation. |
Wait | () -> ...any | Yes | Yields until Fire resumes the waiter with the fired values. |
Fire | (...values: any) -> () | Yes | Runs connected callbacks and resumes waiters with the provided values. |
| Name | Type | Required | Mô tả |
|---|---|---|---|
Disconnect | () -> () | Yes | Disconnects the connection. |
local signal = Signal.new()
local connection = signal:Connect(function(value)
print(value)
end)
signal:Fire(1)
connection:Disconnect()