Regular API function

simWaitForSignal

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 simWait.
C synopsis -
C parameters
-
C return value
-
Lua synopsis
Number/string signalValue=simWaitForSignal(string signalName)

The function is equivalent to:

signalValue=nil
while (signalValue==nil) do
    signalValue=simGetIntegerSignal(signalName) or simGetFloatSignal(signalName) or
                                                  simGetStringSignal(signalName)
    if (signalValue==nil) then
        simSwitchThread()
    end
end
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