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
Callbackobject that can be used in async API calls.Parameter
-
#function func:
Return value
-
- async:newGameTimer(delay, callback, arg)
-
Calls callback(arg) in
delaygame 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
delaysimulation 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()indelaygame seconds.The timer will be lost if the game is saved and loaded.
Parameters
-
#number delay: -
#function func:
-
- async:newUnsavableSimulationTimer(delay, func)
-
Calls
func()indelaysimulation 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
-