2021-02-23 20:45:03 +00:00
#################
Lua API reference
#################
.. toctree ::
2021-04-24 22:55:08 +00:00
:hidden:
2021-02-23 20:45:03 +00:00
2021-04-24 22:55:08 +00:00
engine_handlers
2021-11-18 15:19:54 +00:00
user_interface
2021-04-24 22:55:08 +00:00
openmw_util
2021-06-01 21:18:42 +00:00
openmw_settings
2021-04-24 22:55:08 +00:00
openmw_core
openmw_async
openmw_query
openmw_world
openmw_self
openmw_nearby
2021-06-26 21:10:24 +00:00
openmw_input
2021-04-24 22:55:08 +00:00
openmw_ui
2021-11-01 17:39:18 +00:00
openmw_camera
2021-04-24 22:55:08 +00:00
openmw_aux_util
2021-12-01 20:28:05 +00:00
openmw_aux_time
2021-11-01 17:39:18 +00:00
interface_camera
2021-02-23 20:45:03 +00:00
2021-04-24 22:55:08 +00:00
- :ref: `Engine handlers reference`
2021-11-18 15:19:54 +00:00
- :ref: `User interface reference <User interface reference>`
2021-04-24 22:55:08 +00:00
- `Game object reference <openmw_core.html##(GameObject)> `_
- `Cell reference <openmw_core.html##(Cell)> `_
2021-02-23 20:45:03 +00:00
2021-04-24 22:55:08 +00:00
**API packages**
2021-04-02 17:42:19 +00:00
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 |
+=========================================================+====================+===============================================================+
|:ref: `openmw.interfaces <Script interfaces>` | everywhere | | Public interfaces of other scripts. |
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.util <Package openmw.util>` | everywhere | | Defines utility functions and classes like 3D vectors, |
2021-04-02 17:42:19 +00:00
| | | | that don't depend on the game world. |
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-06-01 21:18:42 +00:00
|:ref: `openmw.settings <Package openmw.settings>` | everywhere | | Access to GMST records in content files (implemented) and |
| | | | to mod settings (not implemented). |
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.core <Package openmw.core>` | everywhere | | Functions that are common for both global and local scripts |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.async <Package openmw.async>` | everywhere | | Timers (implemented) and coroutine utils (not implemented) |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.query <Package openmw.query>` | everywhere | | Tools for constructing queries: base queries and fields. |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.world <Package openmw.world>` | by global scripts | | Read-write access to the game world. |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.self <Package openmw.self>` | by local scripts | | Full access to the object the script is attached to. |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-04-24 22:55:08 +00:00
|:ref: `openmw.nearby <Package openmw.nearby>` | by local scripts | | Read-only access to the nearest area of the game world. |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-11-01 17:39:18 +00:00
|:ref: `openmw.input <Package openmw.input>` | by player scripts | | User input. |
2021-06-26 21:10:24 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-11-01 17:39:18 +00:00
|:ref: `openmw.ui <Package openmw.ui>` | by player scripts | | Controls :ref: `user interface <User interface reference>` . |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-11-01 17:39:18 +00:00
|:ref: `openmw.camera <Package openmw.camera>` | by player scripts | | Controls camera. |
2021-04-02 17:42:19 +00:00
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-02-23 20:45:03 +00:00
2021-04-24 22:55:08 +00:00
**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 |
+=========================================================+====================+===============================================================+
|:ref: `openmw_aux.util <Package openmw_aux.util>` | everywhere | | Miscellaneous utils |
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-12-01 20:28:05 +00:00
|:ref: `openmw_aux.time <Package openmw_aux.time>` | everywhere | | Timers and game time utils |
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
2021-11-01 17:39:18 +00:00
**Interfaces of built-in scripts**
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+
| Interface | Can be used | Description |
+=========================================================+====================+===============================================================+
|:ref: `Camera <Interface Camera>` | by player scripts | | Allows to alter behavior of the built-in camera script |
| | | | without overriding the script completely. |
+---------------------------------------------------------+--------------------+---------------------------------------------------------------+