RealSignal

RealSignal.Fire

Fires the RealSignal with zero or more values.

Sintaxe

RealSignal.Fire(signal: RealSignal, ...values?: ....any)

Argumentos

NomeTipoDescrição
signalRealSignalSignal object returned by Signal.new.
...values?....anyValues forwarded to connected callbacks and waiting threads.

Descrição

Fires the RealSignal with zero or more values. Connected callbacks receive those values, once connections are disconnected before invocation, and waiting threads are resumed with the same values. The method returns no values.

Chame com 2 parametro(s): signal, ...values. A tabela de argumentos explica quais valores sao obrigatorios e quais refinam o comportamento.

Nao retorna dados. Trate a chamada como uma acao e lide com erros no ponto de chamada.

Exemplo

Forward values to connected callbacks and waiting threads.

local signal = Signal.new()
local total = 0

signal:Connect(function(value)
    total += value
end)

signal:Fire(5)
print(total)

Tipos

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.