Package openmw.async
Contains timers and coroutine utilities.
All functions require the package itself as a first argument.
Usage
local async = require('openmw.async')
Type async
| async:callback(func) |
Wraps a Lua function with a |
| 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 a Lua function with a
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.The 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.The 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
-