Regular API function

simWaitForSignal / sim.waitForSignal

Description Waits for a signal. Signals are cleared at simulation start. This function will first check whether an integer signal with that name is present, then if a float signal with that name is present and finally if a string signal with that name is present. The function only returns when the signal is present (defined). This function can only be called from child scripts running in a thread (since this is a blocking operation) and is not available from the C-API. See also the other signal functions and sim.wait.
C synopsis -
C parameters
C return value
Lua synopsis
Number/string signalValue=sim.waitForSignal(string signalName)

The function is equivalent to:

while (signalValue==nil) do
    signalValue=sim.getIntegerSignal(signalName) or sim.getFloatSignal(signalName) or
    if (signalValue==nil) then
Lua parameters
signalName: name of the signal
Lua return values
signalValue: value of the signal, or nil when the command is cancelled by stopping the simulation

All regular API functions on one page