Allows for the registration of custom console commands through the global object named commands. Similarly to event subscriptions, these don’t persist through a save-and-load cycle.
This is an abstract base class containing the common functionality between LuaPlayer and entities (see LuaEntity). When accessing player-related functions through a LuaEntity, it must refer to a character entity.
The control behavior for an entity. Inserters have logistic network and circuit network behavior logic, lamps have circuit logic and so on. This is an abstract base class that concrete control behaviors inherit.
Cancels the given amount of crafts at the given crafting queue position. If this causes any later crafts that depend on the cancelled one to have insufficient ingredients, those crafts will also be cancelled.
Lazily evaluated table. For performance reasons, we sometimes return a custom table-like type instead of a native Lua table. This custom type lazily constructs the necessary Lua wrappers of the corresponding C++ objects, therefore preventing their unnecessary construction in some cases.
A LuaElectricNetwork represents a group of LuaElectricSubNetworks that are directly or indirectly connected to each other through implicit connections (closed power switches, surface connections) and during next electric network update will transfer electricity from producers and consumers.
The primary interface for interacting with entities through the Lua API. Entities are everything that exists on the map except for tiles (see LuaTile).
Gets the flow count value for the given time frame. If sample_index is not provided, then the value returned is the average across the provided precision time period. These are the values shown in the bottom section of the statistics GUIs.
LuaForce encapsulates data local to each “force” or “faction” of the game. Default forces are player, enemy and neutral. Players and mods can create additional forces (up to 64 total).
Take a screenshot of the game and save it to the script-output folder, located in the game’s user data directory. The name of the image file can be specified via the path parameter.
Take a screenshot of the technology screen and save it to the script-output folder, located in the game’s user data directory. The name of the image file can be specified via the path parameter.
The root of the GUI. This type houses the root elements, top, left, center, goal, and screen, to which other elements can be added to be displayed on screen.
An element of a custom GUI. This type is used to represent any kind of a GUI element - labels, buttons and frames are all instances of this type. Just like LuaEntity, different kinds of elements support different attributes; attempting to access an attribute on an element that doesn’t support it (for instance, trying to access the column_count of a textfield) will result in a runtime error.
Provides various helper and utility functions. It is accessible through the global object named helpers in all stages (settings, prototype and runtime).
A reference to an item with data. In contrast to LuaItemStack, this is binding to a specific item data even if it would move between entities or inventories.
Common methods related to usage of item with data. It is useful when LuaItemStack contains item with data or in general with LuaItem as it can only point at an item with data.
A lazily loaded value. For performance reasons, we sometimes return a custom lazily-loaded value type instead of the native Lua value. This custom type lazily constructs the necessary value when LuaLazyLoadedValue::get is called, therefore preventing its unnecessary construction in some cases.
Logistic cell of a particular LuaEntity. A “Logistic Cell” is the given name for settings and properties used by what would normally be seen as a “Roboport”. A logistic cell however doesn’t have to be attached to the roboport entity (the character has one for the personal roboport).
Logistic point of a particular LuaEntity. A “Logistic point” is the name given for settings and properties used by requester, provider, and storage points in a given logistic network. These “points” don’t have to be a logistic container but often are. One other entity that can own several points is the “character” character type entity.
A player in the game. Pay attention that a player may or may not have a character, which is the LuaEntity of the little guy running around the world doing things.
Spawn flying text that is only visible to this player. Either position or create_at_cursor are required. When create_at_cursor is true, all parameters other than text are ignored.
A deterministic random generator independent from the core games random generator that can be seeded and re-seeded at will. This random generator can be saved and loaded and will maintain its state.
A reference to a record in the blueprint library. Records in the “my blueprints” shelf are read-only, but records in the “game blueprints” shelf are read/write.
Registry of interfaces between scripts. An interface is simply a dictionary mapping names to functions. A script or mod can then register an interface with LuaRemote, after that any script can call the registered functions, provided it knows the interface name and the desired function name. An instance of LuaRemote is available through the global object named remote.
Allows rendering of geometric shapes, text and sprites in the game world through the global object named rendering. Each render object is identified by an id that is universally unique for the lifetime of a whole game.
Create a gradient light which is not occluded by any sprites. It is rendered at lower resolution, so it takes less GPU power. The same technique is used for lights drawn by LightDefinition.
An individual segment of a LuaSegmentedUnit. If the segment exists in a generated chunk, you can access the entity representation using LuaSegment::entity.
Object containing the three different types of mod settings: startup settings, global runtime settings and per-player runtime settings. An instance of LuaSettings is available through the global object named settings.
A “domain” of the world, such as a planet or space platform. Surfaces are uniquely identified by their name. Every game contains at least the surface “nauvis”.
Create a segmented unit on the surface. This differs from creating an entity with type "segmented-unit" in that this method can create the entity in non-generated chunks and with any arbitrary body shape and pre-assigned to a territory.
Generates a path with the specified constraints (as an array of PathfinderWaypoints) using the unit pathfinding algorithm. This path can be used to emulate pathing behavior by script for non-unit entities, such as vehicles. If you want to command actual units (such as biters or spitters) to move, use LuaCommandable::set_command via LuaEntity::commandable instead.
The undo queue for a player. The term item_index refers to the index of an undo item in the queue, while action_index refers to the index of one of the individual actions that make up an undo item.