Factorio Runtime DocsVersion 1.1.107

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.

  • remote :: LuaRemote:

    Allows registration and use of functions to communicate between mods.

  • commands :: LuaCommandProcessor:

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

  • settings :: LuaSettings:

    Provides access to the current mod settings.

  • rcon :: LuaRCON:

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

  • rendering :: LuaRendering:

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

Additional global objects:

  • Defines: Content of the defines table, which contains symbolic constants used throughout the API.
  • Libraries and functions: General Lua libraries and functions that Factorio provides or modifies.
  • global: The global 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.
  • Built-in types: Fundamental built-in Lua types.

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

Classes

Events

Concepts

Defines

Builtin types