Module DCStimer

Global(s)

timer

Type timer

timer.getAbsTime()

Returns mission time in seconds.

timer.getTime()

Returns model time in seconds.

timer.getTime0()

Returns mission start time in seconds.

timer.removeFunction(functionId)

Removes the function from schedule.

timer.scheduleFunction(functionToCall, functionArgument, time)

Schedules function to call at desired model time.

timer.setFunctionTime(functionId, time)

Re-schedules function to call at another model time.

Global(s)

#timer timer

Type DCStimer

Type FunctionToCall

Type Time

Type timer

Field(s)

timer.getAbsTime()

Returns mission time in seconds.

Return value

#Time:

timer.getTime()

Returns model time in seconds.

Return value

#Time:

timer.getTime0()

Returns mission start time in seconds.

Return value

#Time:

timer.removeFunction(functionId)

Removes the function from schedule.

Parameter

  • functionId : Function identifier to remove from schedule

timer.scheduleFunction(functionToCall, functionArgument, time)

Schedules function to call at desired model time.

Time function FunctionToCall(any argument, Time time)

...

return ...

end

Must return model time of next call or nil. Note that the DCS scheduler calls the function in protected mode and any Lua errors in the called function will be trapped and not reported. If the function triggers a Lua error then it will be terminated and not scheduled to run again.

Parameters

  • #FunctionToCall functionToCall : Lua-function to call. Must have prototype of FunctionToCall.

  • functionArgument : Function argument of any type to pass to functionToCall.

  • #Time time : Model time of the function call.

Return value

functionId

timer.setFunctionTime(functionId, time)

Re-schedules function to call at another model time.

Parameters

  • functionId : Lua-function to call. Must have prototype of FunctionToCall.

  • #Time time : Model time of the function call.