Factorio Runtime DocsVersion 2.0.26

Runtime API Docs

During the runtime stage, the game fires events for mods to react to, with functionality being accessible via the methods and attributes of various classes. To access instances of these classes, a handful of global objects are provided, as listed below.

The runtime stage is the game's third and final stage, taking place after the settings and prototype stages. All important details are explained via the Data Lifecycle.

Main global objects:

  • game :: LuaGameScript:

    The main scripting interface through which most of the API is accessed.

  • script :: LuaBootstrap:

    Provides an interface for registering game event handlers.

  • commands :: LuaCommandProcessor:

    Allows registration of custom commands for the in-game console.

  • helpers :: LuaHelpers:

    Provides access to various helper and utility functions.

  • prototypes :: LuaPrototypes:

    Allows read-only access to prototypes.

  • rcon :: LuaRCON:

    Allows printing messages to the calling RCON instance, if any.

  • remote :: LuaRemote:

    Allows registration and use of functions to communicate between mods.

  • rendering :: LuaRendering:

    Allows rendering of geometric shapes, text and sprites in the game world.

  • settings :: LuaSettings:

    Provides access to the current mod settings.

Additional global objects:

  • Libraries and functions: General Lua libraries and functions that Factorio provides or modifies.
  • storage: The storage dictionary, used for storing data that persists across a save-load cycle.

Data types used across the API:

  • Concepts: Complex types that various API methods expect or return.
  • Defines: Content of the defines table, which contains symbolic constants used throughout the API.

The runtime API documentation is also available in a machine-readable format that developer tools can use.

Classes

Concepts

Events

Defines