Package openmw.asyncΒΆ

openmw.async contains timers and coroutine utils.

All functions require the package itself as a first argument.

Usage:

local async = require('openmw.async')

Type async

async:callback(func)

Wraps Lua function with Callback object that can be used in async API calls.

async:newTimerInHours(delay, callback, arg)

Calls callback(arg) in delay game hours.

async:newTimerInSeconds(delay, callback, arg)

Calls callback(arg) in delay seconds.

async:newUnsavableTimerInHours(delay, func)

Calls func() in delay game hours.

async:newUnsavableTimerInSeconds(delay, func)

Calls func() in delay seconds.

async:registerTimerCallback(name, func)

Register a function as a timer callback.

Type async

Field(s)

async:callback(func)

Wraps Lua function with Callback object that can be used in async API calls.

Parameter

  • #function func :

Return value

#Callback:

async:newTimerInHours(delay, callback, arg)

Calls callback(arg) in delay game hours.

Callback must be registered in advance.

Parameters

  • #number delay :

  • #TimerCallback callback : A callback returned by registerTimerCallback

  • arg : An argument for callback; can be nil.

async:newTimerInSeconds(delay, callback, arg)

Calls callback(arg) in delay seconds.

Callback must be registered in advance.

Parameters

  • #number delay :

  • #TimerCallback callback : A callback returned by registerTimerCallback

  • arg : An argument for callback; can be nil.

async:newUnsavableTimerInHours(delay, func)

Calls func() in delay game hours.

The timer will be lost if the game is saved and loaded.

Parameters

  • #number delay :

  • #function func :

async:newUnsavableTimerInSeconds(delay, func)

Calls func() in delay seconds.

The timer will be lost if the game is saved and loaded.

Parameters

  • #number delay :

  • #function func :

async:registerTimerCallback(name, func)

Register a function as a timer callback.

Parameters

  • #string name :

  • #function func :

Return value

#TimerCallback:

Type Callback

Type TimerCallback