Regular API function

simWait

Description Waits for a certain amount of time. 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 simWaitForSignal.
C synopsis -
C parameters
-
C return value
-
Lua synopsis number deltaTimeLeft=simWait(number deltaTime,Boolean simulationTime)
Lua parameters
deltaTime: the minimum time duration to wait. If the function was called at simulation time X (or real-time X), then the function will return when simulation time>=X+deltaTime (or when real-time>=X+deltaTime)
simulationTime: indicates whether we want to wait in terms of simulation- or real-time. Can be omitted (is true by default)
Lua return values
deltaTimeLeft: the "wait resolution" of this function is the simulation time step, and the simWait command may overshoot the requested waiting time. deltaTimeLeft is the negative overshoot time. If the function was called at simulation time X, and the function returned at simulation time Y, then deltaTimeLeft is deltaTime-(Y-X). In case of an error, deltaTimeLeft is nil. deltaTimeLeft is also memorized internally on a thread-basis and used as compensation or correction factor in subsequent blocking commands. deltaTimeLeft is 0 if the simulationTime argument was false

All regular API functions on one page