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 |
async:newGameTimer(delay, callback, arg) |
Calls callback(arg) in |
async:newSimulationTimer(delay, callback, arg) |
Calls callback(arg) in |
async:newUnsavableGameTimer(delay, func) |
Calls |
async:newUnsavableSimulationTimer(delay, func) |
Calls |
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
-
- async:newGameTimer(delay, callback, arg)
-
Calls callback(arg) in
delay
game seconds.Callback must be registered in advance.
Parameters
-
#number delay
: -
#TimerCallback callback
: A callback returned byregisterTimerCallback
-
arg
: An argument forcallback
; can benil
.
-
- async:newSimulationTimer(delay, callback, arg)
-
Calls callback(arg) in
delay
simulation seconds.Callback must be registered in advance.
Parameters
-
#number delay
: -
#TimerCallback callback
: A callback returned byregisterTimerCallback
-
arg
: An argument forcallback
; can benil
.
-
- async:newUnsavableGameTimer(delay, func)
-
Calls
func()
indelay
game seconds.The timer will be lost if the game is saved and loaded.
Parameters
-
#number delay
: -
#function func
:
-
- async:newUnsavableSimulationTimer(delay, func)
-
Calls
func()
indelay
simulation 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
-