Lua API reference
API packages
API packages provide functions that can be called by scripts. I.e. it is a script-to-engine interaction.
A package can be loaded with require('<package name>').
It can not be overloaded even if there is a lua file with the same name.
The list of available packages is different for global and for local scripts.
Player scripts are local scripts that are attached to a player.
Package |
Can be used |
Description |
|---|---|---|
by player and menu scripts |
Controls background sounds for given player.
|
|
by local and player scripts |
Animation controls
|
|
everywhere |
Timers and callbacks.
|
|
by player scripts |
Controls camera.
|
|
everywhere |
Functions that are common for both global and local scripts
|
|
by player scripts |
Collection of debug utils.
|
|
by player and menu scripts |
User input.
|
|
everywhere |
Public interfaces of other scripts.
|
|
everywhere |
API to work with markup languages.
|
|
by menu scripts |
Main menu functionality, such as managing game saves
|
|
by local and player scripts |
Read-only access to the nearest area of the game world.
|
|
by player scripts |
Controls post-process shaders.
|
|
by local and player scripts |
Full access to the object the script is attached to.
|
|
everywhere |
Storage API. In particular can be used to store data
between game sessions.
|
|
everywhere |
Functions for specific types of game objects.
|
|
by player and menu scripts |
Controls user interface.
|
|
everywhere |
Defines utility functions and classes like 3D vectors,
that don’t depend on the game world.
|
|
everywhere |
Read-only access to data directories via VFS.
|
|
by global scripts |
Read-write access to the game world.
|
openmw_aux
openmw_aux.* are built-in libraries that are itself implemented in Lua. They can not do anything that is not possible with the basic API, they only make it more convenient.
Sources can be found in resources/vfs/openmw_aux. In theory mods can override them, but it is not recommended.
Built-in library |
Can be used |
Description |
|---|---|---|
everywhere |
Game time calendar
|
|
everywhere |
Miscellaneous utils
|
|
everywhere |
Timers and game time utils
|
|
by player and menu scripts |
User interface utils
|
Interfaces of built-in scripts
Interface |
Can be used |
Description |
by global scripts |
Allows to extend or override built-in activation mechanics. |
|
by local scripts |
Control basic AI of NPCs and creatures. |
|
by local scripts |
Control animations of NPCs and creatures. |
|
by player scripts |
Allows to alter behavior of the built-in camera script
without overriding the script completely.
|
|
by player scripts |
Allows to alter behavior of the built-in script
that handles player controls.
|
|
by player scripts |
Allows to alter behavior of the built-in script
that handles player gamepad controls.
|
|
by global scripts |
Allows to extend or override built-in item usage
mechanics.
|
|
by local scripts |
Control, extend, and override skill progression of the
player.
|
|
by player, menu, and global scripts |
Save, display and track changes of setting values. |
|
by player and menu scripts |
Morrowind-style UI templates. |
|
by player scripts |
High-level UI modes interface. Allows to override parts
of the interface.
|
|
by global scripts |
Commit crimes. |