XLua2 API Ref XPLMProcessing Latest - 4.4.0-d4

Xlua Timers


xlua_timer

typedef

Opaque handle to an XLua timer, returned by XLuaCreateTimer / XLuaFindTimer and passed to the other timer functions.

local my_result = nil  -- xlua_timer

Used by:


XLuaCreateTimer

function

Create a timer bound to the given callback (a function called with no arguments when the timer fires). The timer is not scheduled until you call XLuaRunTimer.

-- returns xlua_timer -> assign to local/var
local my_result = XLuaCreateTimer(
    callback     -- any Lua var/table
)

XLuaRunTimer

function

Schedule a timer to fire after delay seconds, optionally repeating every period seconds. Pass period <= 0 for a one-shot timer.

XLuaRunTimer(
    timer,     -- xlua_timer
    delay,     -- float
    period     -- float
)

See associated types:


XLuaFindTimer

function

Find the existing timer bound to callback (the function passed to XLuaCreateTimer), or nil if none exists.

-- returns xlua_timer -> assign to local/var
local my_result = XLuaFindTimer(
    callback     -- any Lua var/table
)

XLuaIsTimerScheduled

function

Returns true if the timer is currently scheduled to fire.

-- returns boolean -> assign to local/var
local my_result = XLuaIsTimerScheduled(
    timer     -- xlua_timer
)

See associated types:


XLuaGetTimerRemaining

function

Seconds until the timer next fires, or -1 if it is not scheduled.

-- returns float -> assign to local/var
local my_result = XLuaGetTimerRemaining(
    timer     -- xlua_timer
)

See associated types:


XLuaReloadOnFlightChange

function

Mark this aircraft's scripts as needing a full reload whenever flight details (livery, situation) change.

XLuaReloadOnFlightChange(
)