VoltSignal:Fire
Fires the signal with the given arguments.
Syntax
VoltSignal:Fire(...: any) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
... | any | Arguments to pass to connected handlers |
Returns
This method does not return a value.
Description
VoltSignal:Fire triggers all connected handlers and resumes any threads waiting on the signal. All provided arguments are passed to each handler and returned by Wait.
Example
local signal = VoltSignal.new()
signal:Connect(function(a, b, c)
print(a, b, c)
end)
-- Fire with multiple arguments
signal:Fire("hello", 42, true)
-- Output: hello 42 trueFiring Without Arguments
local onComplete = VoltSignal.new()
onComplete:Connect(function()
print("Task completed!")
end)
onComplete:Fire()
-- Output: Task completed!Firing With Tables
local onDataReceived = VoltSignal.new()
onDataReceived:Connect(function(data)
print("Received:", data.name, data.value)
end)
onDataReceived:Fire({ name = "Score", value = 100 })
-- Output: Received: Score 100Related Functions
VoltSignal:Connect- Connect handlersVoltSignal:Wait- Wait for fire