In general, the Factorio API consists of 3 phases:
For more information about how mods are loaded, initialized, and the different phases, see Data Lifecycle.
All of the scripting API functionality is implemented via class members. To make any use of the API, therefore, you need to have access to instances of these classes. To facilitate that, some are provided as global classes.
This is the main object, through which most of the API is accessed. It is, however, not available inside handlers registered with LuaBootstrap::on_load.
Provides an interface for registering event handlers.
Allows inter-mod communication by way of providing a repository of interfaces that is shared by all mods.
Allows registering custom commands for the in-game console accessible via the grave key.
Allows reading the current mod settings.
Allows printing messages to the calling RCON instance if any.
Allows rendering of geometric shapes, text and sprites in the game world.
Other global objects:
globaldictionary, useful for storing data persistent across a save-load cycle.
definestable, which contains symbolic constants used throughout the API.
The following data types are used across the API:
The API documentation is also available in a machine-readable format that developer tools can use.