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 |
Context |
Description |
|---|---|---|
menu player |
Controls background sounds for given player. |
|
local |
Animation controls. |
|
global menu local load |
Timers and callbacks. |
|
player |
Controls camera. |
|
load |
Content manipulation. |
|
global menu local load |
Functions that are common for both global and local scripts |
|
player |
Collection of debug utils. |
|
menu player |
User input. |
|
global menu local load |
Public interfaces of other scripts. |
|
global menu local load |
API to work with markup languages. |
|
menu |
Main menu functionality, such as managing game saves |
|
local |
Read-only access to the nearest area of the game world. |
|
player |
Controls post-process shaders. |
|
local |
Full access to the object the script is attached to. |
|
global menu local load |
Storage API. In particular can be used to store data between game sessions. |
|
global menu local |
Functions for specific types of game objects. |
|
menu player |
Controls user interface. |
|
global menu local load |
Defines utility functions and classes like 3D vectors, that don’t depend on the game world. |
|
global menu local load |
Read-only access to data directories via VFS. |
|
global |
Read-write access to the game world. |
Auxiliary packages
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.
Module |
Context |
Description |
|---|---|---|
global menu local |
Game time calendar |
|
global menu local |
Timers and game time utils |
|
menu player |
User interface utils |
|
global menu local load |
Miscellaneous utils |
Interfaces of built-in scripts
Interface |
Context |
Description |
|---|---|---|
global |
Allows to extend or override built-in activation mechanics. |
|
local |
Control basic AI of NPCs and creatures. |
|
local |
Control animations of NPCs and creatures. |
|
player |
Allows to alter behavior of the built-in camera script without overriding the script completely. |
|
player |
Allows to alter behavior of the built-in script that handles player controls. |
|
global |
Commit crimes. |
|
local |
Control combat of NPCs and creatures |
|
player |
Allows to alter behavior of the built-in script that handles player gamepad controls. |
|
global |
Allows to extend or override built-in item usage mechanics. |
|
menu player |
Morrowind-style UI templates. |
|
global menu player |
Save, display and track changes of setting values. |
|
player |
Control, extend, and override skill progression of the player. |
|
player |
High-level UI modes interface. Allows to override parts of the interface. |
|
player |
Access to reading/writing assigned quick keys |