Classes

This is a list of all Lua classes defined by Factorio.

class LuaBootstrap - sort
on_init(f) Register a callback to be run on mod init.
on_load(f) Register a function to be run on module load.
on_configuration_changed(f) Register a function to be run when mod configuration changes.
on_event(event, f) Register a handler to run on event or events.
generate_event_name() → uint Generate a new, unique event ID.
get_event_handler(event) Find the event handler for an event.
raise_event(event, table) Raise an event.
class LuaBurner - sort
owner :: LuaEntity or LuaEquipment [R] The owner of this burner energy source
inventory :: LuaInventory [R] The fuel inventory.
burnt_result_inventory :: LuaInventory [R] The burnt result inventory.
heat :: double [RW]
heat_capacity :: double [R]
remaining_burning_fuel :: double [RW]
currently_burning :: LuaItemPrototype [RW]
fuel_category :: string [R] The fuel category this burner uses.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaBurnerPrototype - sort
emissions :: double [R]
category :: string [R]
render_no_network_icon :: boolean [R]
render_no_power_icon :: boolean [R]
effectivity :: double [R]
fuel_inventory_size :: uint [R]
burnt_inventory_size :: uint [R]
smoke [R] The smoke sources for this burner prototype if any.
light_flicker [R] The light flicker definition for this burner prototype if any.
fuel_category :: string [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaChunkIterator - sort
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaCircuitNetwork - sort
get_signal(signal) → int
entity :: LuaEntity [R] The entity this circuit network reference is associated with
wire_type :: defines.wire_type [R] The wire type this network is associated with.
circuit_connector_id :: defines.circuit_connector_id [R] The circuit connector ID on the associated entity this network was gotten from.
signals :: array of Signal [R] The circuit network signals last tick.
network_id :: uint [R] The circuit networks ID.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaCommandProcessor - sort
add_command(name, help, function) Add a command.
remove_command(string) → boolean Removes a registered command
commands :: dictionary stringLocalisedString [R] The script registered commands
game_commands :: dictionary stringLocalisedString [R] The script registered commands
class LuaControl - sort
get_inventory(inventory) → LuaInventory Get an inventory belonging to this entity.
get_quickbar() → LuaInventory Get the quickbar belonging to this entity if any.
can_insert(items) → boolean Can at least some items be inserted?
insert(items) → uint Insert items into this entity.
set_gui_arrow{type=…} Create an arrow which points at this entity.
clear_gui_arrow() Removes the arrow created by set_gui_arrow.
get_item_count(item) → uint Get the number of all or some items in this entity.
has_items_inside() → boolean Does this entity have any item inside it?
can_reach_entity(entity) → boolean Can a given entity be opened or accessed?
clear_items_inside() Remove all items from this entity.
remove_item(items) → uint Remove items from this entity.
teleport(position, surface) → boolean Teleport the entity to a given position, possibly on another surface.
update_selected_entity(position) Select an entity, as if by hovering the mouse above it.
clear_selected_entity() Unselect any selected entity.
disable_flashlight() Disable the flashlight.
enable_flashlight() Enable the flashlight.
get_craftable_count(recipe) → uint Gets the count of the given recipe that can be crafted.
begin_crafting{count=…, recipe=…, silent=…} → uint Begins crafting the given count of the given recipe
cancel_crafting(options) Cancels crafting the given count of the given crafting queue index
mine_entity(entity, force) → boolean Mines the given entity as if this player (or character) mined it.
mine_tile(tile) → boolean Mines the given tile as if this player (or character) mined it.
surface :: LuaSurface [R] The surface this entity is currently on.
position :: Position [R] Current position of the entity.
vehicle :: LuaEntity [R] The vehicle the player is currently sitting in; nil if none.
force :: string or LuaForce [RW] The force of this entity.
selected :: LuaEntity [R] The currently selected entity; nil if none.
opened :: LuaEntity or LuaItemStack or LuaEquipment or defines.gui_type [RW] The GUI target the player currently has open; nil if none.
crafting_queue_size :: uint [R] Size of the crafting queue.
walking_state [RW] Current walking state.
riding_state [RW] Current riding state of this car or the vehicle this player is riding in.
mining_state [RW] Current mining state.
shooting_state [RW] Current shooting state.
picking_state :: boolean [RW] Current item-picking state.
repair_state [RW] Current repair state.
cursor_stack :: LuaItemStack [R] The player's cursor stack.
driving :: boolean [RW] true if the player is in a vehicle.
crafting_queue :: array of CraftingQueueItem [R] Gets the current crafting queue items.
cheat_mode :: boolean [RW] When true hand crafting is free and instant
character_crafting_speed_modifier :: double [RW]
character_mining_speed_modifier :: double [RW]
character_running_speed_modifier :: double [RW]
character_build_distance_bonus :: uint [RW]
character_item_drop_distance_bonus :: uint [RW]
character_reach_distance_bonus :: uint [RW]
character_resource_reach_distance_bonus :: uint [RW]
character_item_pickup_distance_bonus :: uint [RW]
character_loot_pickup_distance_bonus :: uint [RW]
quickbar_count_bonus :: uint [RW]
character_inventory_slots_bonus :: uint [RW]
character_logistic_slot_count_bonus :: uint [RW]
character_trash_slot_count_bonus :: uint [RW]
character_maximum_following_robot_count_bonus :: uint [RW]
character_health_bonus :: float [RW]
auto_trash_filters :: dictionary stringuint [RW] The auto-trash filters.
opened_gui_type [R] Returns the defines.gui_type or nil.
build_distance :: uint [R] The build distance of this character or max uint when not a character or player connected to a character.
drop_item_distance :: uint [R] The item drop distance of this character or max uint when not a character or player connected to a character.
reach_distance :: uint [R] The reach distance of this character or max uint when not a character or player connected to a character.
item_pickup_distance :: double [R] The item pickup distance of this character or max double when not a character or player connected to a character.
loot_pickup_distance :: double [R] The loot pickup distance of this character or max double when not a character or player connected to a character.
resource_reach_distance :: double [R] The resource reach distance of this character or max double when not a character or player connected to a character.
class LuaControlBehavior - sort
get_circuit_network(wire, circuit_connector) → LuaCircuitNetwork
type :: defines.control_behavior.type [R] The concrete type of this control behavior.
entity :: LuaEntity [R] The entity this control behavior belongs to.
class LuaAccumulatorControlBehavior extends LuaControlBehavior - sort
output_signal :: SignalID [RW]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaCombinatorControlBehavior extends LuaControlBehavior - sort
get_signal_last_tick(signal) → int Gets the value of a specific signal sent by this combinator behavior last tick or nil if the signal didn't exist.
signals_last_tick :: array of Signal [R] The circuit network signals sent by this combinator last tick.
class LuaConstantCombinatorControlBehavior extends LuaControlBehavior - sort
set_signal(index, ConstantCombiantorSignal) Sets the signal at the given index
get_signal(index) Gets the signal at the given index or nil if there is none.
parameters [RW] The constant combinator parameters
enabled :: boolean [RW] Turns this constant combinator on and off.
signals_count :: uint [R] The number of signals this constant combinator supports
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaContainerControlBehavior extends LuaControlBehavior - sort
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaGenericOnOffControlBehavior extends LuaControlBehavior - sort
disabled :: boolean [R] If the entity is currently disabled because of the control behavior.
circuit_condition :: CircuitConditionSpecification [RW] The circuit condition.
logistic_condition :: CircuitConditionSpecification [RW] The logistic condition.
connect_to_logistic_network :: boolean [RW] true if this should connect to the logitic network.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaLogisticContainerControlBehavior extends LuaControlBehavior - sort
circuit_mode_of_operation :: defines.control_behavior.logistic_container.circuit_mode_of_operation [RW] The circuit mode of operations for the logistic container.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaProgrammableSpeakerControlBehavior extends LuaControlBehavior - sort
circuit_parameters :: ProgrammableSpeakerCircuitParameters [RW]
circuit_condition :: CircuitConditionSpecification [RW]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaRailSignalControlBehavior extends LuaControlBehavior - sort
red_signal :: SignalID [RW]
orange_signal :: SignalID [RW]
green_signal :: SignalID [RW]
close_signal :: boolean [RW] If this will close the rail signal based off the circuit condition.
read_signal :: boolean [RW] If this will read the rail signal state.
circuit_condition :: CircuitConditionSpecification [RW] The circuit condition when controlling the signal through the circuit network.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaRoboportControlBehavior extends LuaControlBehavior - sort
mode_of_operations :: defines.control_behavior.roboport.circuit_mode_of_operation [RW]
available_logistic_output_signal :: SignalID [RW]
total_logistic_output_signal :: SignalID [RW]
available_construction_output_signal :: SignalID [RW]
total_construction_output_signal :: SignalID [RW]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaStorageTankControlBehavior extends LuaControlBehavior - sort
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaWallControlBehavior extends LuaControlBehavior - sort
circuit_condition :: CircuitConditionSpecification [RW] The circuit condition.
open_gate :: boolean [RW]
read_sensor :: boolean [RW]
output_signal :: SignalID [RW]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaArithmeticCombinatorControlBehavior extends LuaCombinatorControlBehavior - sort
parameters :: ArithmeticCombinatorParameters [RW] The arithmetic combinator parameters.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaDeciderCombinatorControlBehavior extends LuaCombinatorControlBehavior - sort
parameters :: DeciderCombinatorParameters [RW] The decider combinator parameters
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaInserterControlBehavior extends LuaGenericOnOffControlBehavior - sort
circuit_read_hand_contents :: boolean [RW] true if the contents of the inserter hand should be sent to the circuit network
circuit_mode_of_operation :: defines.control_behavior.inserter.circuit_mode_of_operation [RW] The circuit mode of operations for the inserter.
circuit_hand_read_mode :: defines.control_behavior.inserter.hand_read_mode [RW] The hand read mode for the inserter.
circuit_set_stack_size :: boolean [RW] If the the stack size of the inserter is set through the circuit network or not.
circuit_stack_control_signal :: SignalID [RW] The signal used to set the stack size of the inserter.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaLampControlBehavior extends LuaGenericOnOffControlBehavior - sort
use_colors :: boolean [RW] true if the lamp should set the color from the circuit network signals.
color :: Color [R] The color the lamp is showing or nil if not using any color.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaMiningDrillControlBehavior extends LuaGenericOnOffControlBehavior - sort
circuit_enable_disable :: boolean [RW] true if this drill is enabled or disabled using the logistics or circuit condition.
circuit_read_resources :: boolean [RW] true if this drill should send the resources in the field to the circuit network.
resource_read_mode :: defines.control_behavior.mining_drill.resource_read_mode [RW] If the mining drill should send just the resources in its area or the entire field it's on to the circuit network.
resource_read_targets :: array of LuaEntity [R] The resource entities that the mining drill will send information about to the circuit network or an empty array.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTrainStopControlBehavior extends LuaGenericOnOffControlBehavior - sort
send_to_train :: boolean [RW] true if the train stop should send the circuit network contents to the train to use.
read_from_train :: boolean [RW] true if the train stop should send the train contents to the circuit network.
read_stopped_train :: boolean [RW] true if the train stop should send the stopped train id to the circuit network.
enable_disable :: boolean [RW] true if the train stop is enabled/disabled through the circuit network.
stopped_train_signal :: SignalID [RW] The signal that will be sent when using the send-train-id option.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTransportBeltControlBehavior extends LuaGenericOnOffControlBehavior - sort
enable_disable :: boolean [RW] If the belt will be enabled/disabled based off the circuit network.
read_contents :: boolean [RW] If the belt will read the contents and send them to the circuit network.
read_contents_mode :: defines.control_behavior.transport_belt.content_read_mode [RW] The read mode for the belt.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaCustomChartTag - sort
destroy() Destroys this tag.
icon :: SignalID [RW]
last_user :: LuaPlayer [RW] The player who last edited this tag.
position :: Position [R] The position of this tag.
orientation :: float [RW] The orientation of this tag.
text :: string [RW]
target :: LuaEntity [RW] The entity target if any or nil.
tag_number :: uint [R] The unique ID for this tag on this force.
force :: LuaForce [R] The force this tag belongs to.
surface :: LuaSurface [R] The surface this tag belongs to.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaCustomTable - sort
operator [] [RW] Access an element of this custom table.
operator # :: uint [R] Number of elements in this table.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaDamagePrototype - sort
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaDecorativePrototype - sort
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
collision_box :: BoundingBox [R] The bounding box used for collision checking.
autoplace_specification :: AutoplaceSpecification [R] Autoplace specification for this decorative prototype.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaElectricEnergySourcePrototype - sort
buffer_capacity :: double [R]
usage_priority :: string [R]
input_flow_limit :: double [R]
output_flow_limit :: double [R]
drain :: double [R]
emissions :: double [R]
category :: string [R]
render_no_network_icon :: boolean [R]
render_no_power_icon :: boolean [R]
effectivity :: double [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaEntity extends LuaControl - sort
get_output_inventory() → LuaInventory Gets the entities output inventory if it has one.
get_module_inventory() → LuaInventory
get_fuel_inventory() → LuaInventory The fuel inventory for this entity or nil if this entity doesn't have a fuel inventory.
get_burnt_result_inventory() → LuaInventory The burnt result inventory for this entity or nil if this entity doesn't have a burnt result inventory.
damage(damage, force, type) → float Damages the entity.
destroy() → boolean Destroys the entity.
set_command(command) Give the entity a command.
has_command() → boolean Has this unit been assigned a command?
die() Immediately kills the entity.
has_flag(flag) → boolean Test whether this entity's prototype has a flag set.
add_market_item{price=…, offer=…} Offer a thing on the market.
remove_market_item(offer) → boolean Remove an offer from a market.
get_market_items() → array of Offer Get all offers in a market as an array.
connect_neighbour(target) Connect two devices with wire or cable.
disconnect_neighbour(target) Disconnect wires or cables.
order_deconstruction(force) → boolean Sets the entity to be deconstructed by construction robots.
cancel_deconstruction(force) Cancels deconstruction if it is scheduled, does nothing otherwise.
to_be_deconstructed(force) → boolean Is this entity marked for deconstruction?
get_request_slot(slot) → SimpleItemStack Get a logistic requester slot.
set_request_slot(request, slot) Set a logistic requester slot.
clear_request_slot(slot) Clear a logistic requester slot.
is_crafting() → boolean
is_opened() → boolean
is_opening() → boolean
is_closed() → boolean
is_closing() → boolean
request_to_open(force, extra_time)
request_to_close(force)
get_transport_line(index) → LuaTransportLine Get a transport line of a belt.
launch_rocket() → boolean
revive(return_item_request_proxy) → dictionary stringuint Revive a ghost.
get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity
get_filter(uint) → string Get the filter for a slot in an inserter or a loader.
set_filter(uint, string) Set the filter for a slot in an inserter or a loader
get_control_behavior() → LuaControlBehavior Gets the control behavior of the entity (if any).
get_or_create_control_behavior() → LuaControlBehavior Gets (and or creates if needed) the control behavior of the entity.
get_circuit_network(wire, circuit_connector) → LuaCircuitNetwork
supports_backer_name() → boolean
copy_settings(entity) → dictionary stringuint Copies settings from the given entity onto this entity.
get_logistic_point(defines.logistic_member_index) → LuaLogisticPoint or array of LuaLogisticPoint Gets the LuaLogisticPoint specified by the given index or if not given returns all of the points this entity owns.
play_note(instrument, note) → boolean Plays a note with the given instrument and note.
connect_rolling_stock(direction) → boolean Connects the rolling stock in the given direction.
disconnect_rolling_stock(direction) → boolean Tries to disconnect this rolling stock in the given direction.
update_connections() Reconnect loader and beacon connections to entities that might have been teleported out or in by the script.
passenger :: LuaEntity or LuaPlayer [RW] Setting to nil forces the character/player out of the vehicle, setting to a new character/player forces any existing passenger out and the given character/player becomes the new passenger.
name :: string [R] Name of the entity prototype.
ghost_name :: string [R] Name of the entity or tile contained in this ghost
localised_name :: LocalisedString [R] Localised name of the entity.
localised_description :: LocalisedString [R]
ghost_localised_name :: LocalisedString [R] Localised name of the entity or tile contained in this ghost.
ghost_localised_description :: LocalisedString [R]
type :: string [R] The entity prototype type of this entity.
ghost_type :: string [R] The prototype type of the entity or tile contained in this ghost.
active :: boolean [RW] Deactivating an entity will stop all its operations (car will stop moving, inserters will stop working, fish will stop moving etc).
destructible :: boolean [RW] When the entity is not destructible it can't be damaged.
minable :: boolean [RW]
rotatable :: boolean [RW] When entity is not to be rotatable (inserter, transport belt etc), it can't be rotated by player using the R key.
operable :: boolean [RW] Player can't open gui of this entity and he can't quick insert/input stuff in to the entity when it is not operable.
health :: float [RW] Health of the entity.
direction :: defines.direction [RW] The current direction this entity is facing.
supports_direction :: boolean [R] Whether the entity has direction.
orientation :: float [RW] The smooth orientation.
amount :: uint [RW] Count of resource units contained.
initial_amount :: uint [RW] Count of initial resource units contained.
effectivity_modifier :: float [RW] Multiplies the acceleration the vehicle can create for one unit of energy.
consumption_modifier :: float [RW] Multiplies the the energy consumption.
friction_modifier :: float [RW] Multiplies the car friction rate.
speed :: float [RW] The current speed of the car.
stack :: LuaItemStack [R]
prototype :: LuaEntityPrototype [R] The entity prototype of this entity.
ghost_prototype :: LuaEntityPrototype or LuaTilePrototype [R] The prototype of the entity or tile contained in this ghost.
drop_position :: Position [RW] Position where the entity puts its stuff.
pickup_position :: Position [RW] Where the inserter will pick up items from.
drop_target :: LuaEntity [R] The entity this entity is putting its stuff to or nil if there is no such entity.
pickup_target :: LuaEntity [R] The entity the inserter will attempt to pick up from.
selected_gun_index :: uint [RW] Index of the currently selected weapon slot of this character.
energy :: double [RW] Energy stored in the entity (heat in furnace, energy stored in electrical devices etc.
temperature :: double [RW] The temperature of this entities heat energy source if this entity uses a heat energy source or nil.
recipe :: LuaRecipe [RW] Current recipe being assembled by this machine.
previous_recipe :: LuaRecipe [R] The previous recipe this furnace was using or nil if the furnace had no previous recipe.
held_stack :: LuaItemStack [R] The item stack currently held in an inserter's hand.
held_stack_position :: Position [R] Current position of the inserter's "hand".
train :: LuaTrain [R] The train this rolling stock belongs to.
neighbours :: dictionary stringarray of LuaEntity or array of LuaEntity or LuaEntity [R]
fluidbox :: LuaFluidBox [RW]
backer_name :: string [RW] The name of a backer (of Factorio) assigned to a lab or train station / stop.
time_to_live :: uint [RW] The ticks left for a ghost before it's destroyed.
color :: Color [RW] The character or rolling stock color.
text :: LocalisedString [RW] The text of this flying-text entity.
signal_state :: defines.signal_state [R] The state of this rail signal.
chain_signal_state :: uint [R] The state of this chain signal.
to_be_looted :: boolean [RW] Will this entity be picked up automatically when the player walks over it?
crafting_progress :: float [RW] The current crafting progress, as a number in range [0, 1].
bonus_progress :: float [RW] The current productivity bonus progress, as a number in range [0, 1].
belt_to_ground_type :: string [R] "input" or "output", depending on whether this underground belt goes down or up.
loader_type :: string [RW] "input" or "output", depending on whether this loader puts to or gets from a container.
rocket_parts :: uint [RW] Number of rocket parts in the silo.
logistic_network :: LuaLogisticNetwork [R] The logistic network this entity is a part of.
logistic_cell :: LuaLogisticCell [R] The logistic cell this entity is a part of.
item_requests :: dictionary stringuint [RW] Items this ghost will request when revived or items this item request proxy is reqeusting.
player :: LuaPlayer [R] The player connected to this character.
unit_group :: LuaUnitGroup [R] The unit group this unit is a member of, or nil if none.
damage_dealt :: double [RW] The damage dealt by this turret.
kills :: uint [RW] The number of units killed by this turret.
last_user :: LuaPlayer [RW] The player who built the entity
electric_buffer_size :: double [RW] The buffer size for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_input_flow_limit :: double [RW] The input flow limit for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_output_flow_limit :: double [RW] The output flow limit for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_drain :: double [RW] The electric drain for the electric energy source or nil if the entity doesn't have an electric energy source.
electric_emissions :: double [RW] The emissions size for the electric energy source or nil if the entity doesn't have an electric energy source.
unit_number :: uint [R] The unit number or nil if the entity doesn't have one.
mining_progress :: double [RW] The mining progress for this mining drill or nil if this isn't a mining drill.
bonus_mining_progress :: double [RW] The bonus mining progress for this mining drill or nil if this isn't a mining drill.
power_production :: double [RW] The power production specific to the ElectricEnergyInterface entity type.
power_usage :: double [RW] The power usage specific to the ElectricEnergyInterface entity type.
bounding_box :: BoundingBox [R]
secondary_bounding_box :: BoundingBox [R] The secondary bounding box of this entity or nil if it doesn't have one.
mining_target :: LuaEntity [R] The mining target or nil if none
circuit_connected_entities [R] Entities connected to this entity via the circuit network.
circuit_connection_definitions :: array of CircuitConnectionDefinition [R] The connection definition for entities connected to this entity via the circuit network.
request_slot_count :: uint [R] The number of request slots this entity has.
filter_slot_count :: uint [R] The number of filter slots this inserter or loader has.
grid :: LuaEquipmentGrid [R] The equipment grid or nil if this entity doesn't have an equipment grid.
graphics_variation :: uint8 [RW] The graphics variation for this entity or nil if this entity doesn't use graphics varaitions.
burner :: LuaBurner [R] The burner energy source for this entity or nil if there isn't one.
shooting_target :: LuaEntity [RW] The shooting target for this turret or nil.
proxy_target :: LuaEntity [R] The target entity for this item-request-proxy or nil
stickers :: array of LuaEntity [R] The sticker entities attached to this entity.
parameters :: ProgrammableSpeakerParameters [RW]
alert_parameters :: ProgrammableSpeakerAlertParameters [RW]
electric_network_statistics :: LuaFlowStatistics [R] The electric network statitiscs for this electric pole.
inserter_stack_size_override :: uint [RW] Sets the stack size limit on this inserter.
products_finished :: float [R]
spawner :: LuaEntity [R] The spawner associated with this unit entity or nil if the unit has no associated spawner.
units :: array of LuaEntity [R] The units associated with this spawner entity.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaEntityPrototype - sort
has_flag(flag) → boolean Does this prototype have a flag enabled?
get_inventory_size(index) → uint Gets the base size of the given inventory on this entity or nil if the given inventory doesn't exist.
type :: string [R] Type of this prototype.
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
max_health :: float [R] Max health of this entity.
infinite_resource :: boolean [R] Is this resource infinite?
minimum_resource_amount :: uint [R] Minimum amount of this resource.
normal_resource_amount :: uint [R] The normal amount for this resource.
infinite_depletion_resource_amount :: uint [R] Every time this infinite resource 'ticks' down it is reduced by this amount.
resource_category :: string [R] Category of this resource.
mineable_properties [R]
items_to_place_this :: dictionary stringLuaItemPrototype [R] Items that when placed will produce this entity.
collision_box :: BoundingBox [R] The bounding box used for collision checking.
selection_box :: BoundingBox [R] The bounding box used for drawing selection.
order :: string [R] Order string of this prototype.
group :: LuaGroup [R] Group of this entity.
subgroup :: LuaGroup [R] Subgroup of this entity.
healing_per_tick :: float [R] Amount this entity can heal per tick.
emissions_per_tick :: double [R] Amount of pollution emissions per tick this entity will create.
corpses :: dictionary stringLuaEntityPrototype [R] Corpses used when this entity is destroyed.
selectable_in_game :: boolean [R] Is this entity selectable?
weight :: double [R] The weight of this vehicle prototype or nil if not a vehicle prototype.
resistances :: Resistances [R]
fast_replaceable_group :: string [R] The group of mutually fast-replaceable entities.
loot :: Loot [R] Loot that will be dropped when this entity is killed.
repair_speed_modifier :: uint [R] Repair-speed modifier for this entity.
turret_range :: uint [R]
autoplace_specification :: AutoplaceSpecification [R] Autoplace specification for this entity prototype.
collision_mask :: array of string [R] The collison masks this entity uses
belt_speed :: double [R] The speed of this transport belt or nil if this isn't a transport belt related prototype.
result_units :: array of UnitSpawnDefinition [R] The result units and spawn points with weight and evolution factor for a biter spawner entity.
attack_result [R] The attack result of this entity if the entity has one else nil.
final_attack_result [R] The final attack result for projectiles nil if not a projectile
attack_parameters [R] The attack parameters for this entity or nil if the entity doesn't use attack parameters.
spawn_cooldown [R] The spawning cooldown for this enemy spawner prototype or nil.
mining_drill_radius :: double [R] The mining radius of this mining drill prototype or nil if this isn't a mining drill prototype.
mining_speed :: double [R] The mining speed of this mining drill/character prototype or nil.
mining_power :: double [R] The mining power of this mining drill prototype or nil if this isn't a mining drill prototype.
logistic_mode :: string [R] The logistic mode of this logistic container or nil if this isn't a logistic container prototype.
max_underground_distance :: uint [R] The max underground distance for underground belts and underground pipes or nil if this isn't one of those prototypes.
drawing_box :: BoundingBox [R] The bounding box used for drawing the entity icon.
sticker_box :: BoundingBox [R] The bounding box used to attach sticker type entities.
flags :: array of string [R] The entity prototype flags for this entitiy.
remains_when_mined :: array of LuaEntityPrototype [R] The remains left behind when this entity is mined.
additional_pastable_entities :: array of LuaEntityPrototype [R] Entities this entity can be pasted onto in addition to the normal allowed ones.
allow_copy_paste :: boolean [R] When false copy-paste is not allowed for this entity.
shooting_cursor_size :: double [R] The cursor size used when shooting at this entity.
created_smoke [R] The smoke trigger run when this entity is built or nil.
created_effect [R] The trigger run when this entity is created or nil.
map_color :: Color [R] The map color used when charting this entity if a friendly or enemy color isn't defined or nil.
friendly_map_color :: Color [R] The friendly map color used when charting this entity.
enemy_map_color :: Color [R] The enemy map color used when charting this entity.
build_base_evolution_requirement :: double [R] The evolution requirement to build this entity as a base when expanding enemy bases.
instruments :: array of ProgrammableSpeakerInstrument [R] The instruments for this programmable speaker or nil.
max_polyphony :: uint [R] The maximum polyphony for this programmable speaker or nil.
module_inventory_size :: uint [R] The module inventory size or nil if this entity doesn't suport modules.
ingredient_count :: uint [R] The max number of ingredients this crafting-machine prototype supports or nil if this isn't a crafting-machine prototype.
crafting_speed :: double [R] The crafting speed of this crafting-machine or nil.
crafting_categories :: dictionary stringboolean [R] The crafting categories this entity supports.
resource_categories :: dictionary stringboolean [R] The resource categories this mining drill supports or nil if not a mining dill.
supply_area_distance :: double [R] The supply area of this electric pole, beacon, or nil if this is neither.
max_wire_distance :: double [R] The maximum wire distance for this electric pole/power switch or nil if this isn't an electric pole/power switch.
max_circuit_wire_distance :: double [R] The maximum circuit wire distance for this entity.
energy_usage :: double [R] The direct energy usage of this entity or nil if this entity doesn't have a direct energy usage.
max_energy_usage :: double [R] The theoretical maximum energy usage for this entity.
effectivity :: double [R] The effectivity of this car prototype, generator prototype or nil.
consumption :: double [R] The energy consumption of this car prototype or nil if not a car prototype.
friction_force :: double [R] The friction of this vehicle prototype or nil if not a vehicle prototype.
braking_force :: double [R] The braking force of this vehicle prototype or nil if not a vehicle prototype.
tank_driving :: boolean [R] If this car prototype uses tank controls to drive or nil if this is not a car prototype.
rotation_speed :: double [R] The rotation speed of this car prototype or nil if not a car prototype.
turret_rotation_speed :: double [R] The turret rotation speed of this car prototype or nil if not a car prototype.
guns :: dictionary stringLuaItemPrototype [R] The guns this car prototype uses or nil if not a car prototype.
speed :: double [R] The default speed of this flying robot, rolling stock or nil.
speed_multiplier_when_out_of_energy :: float [R] The speed multiplier when this flying robot is out of energy or nil.
max_payload_size :: uint [R] The max payload size of this logistics or construction robot or nil.
energy_per_move :: double [R] The energy consumed per tile moved for this flying robot or nil.
energy_per_tick :: double [R] The energy consumed per tick for this flying robot or nil.
max_energy :: double [R] The max energy for this flying robot or nil.
min_to_charge :: float [R] The minimum energy for this flying robot before it tries to recharge or nil.
max_to_charge :: float [R] The maximum energy for this flying robot above which it won't try to recharge when stationing or nil.
burner_prototype :: LuaBurnerPrototype [R] The burner energy source prototype this entity uses or nil.
electric_energy_source_prototype :: LuaElectricEnergySourcePrototype [R] The electric energy source prototype this entity uses or nil.
building_grid_bit_shift :: uint [R] The log2 of grid size of the building
fluid_usage_per_tick :: double [R] The fluid usage of this generator prototype or nil.
maximum_temperature :: double [R] The maximum fluid temperature of this generator prototype or nil.
target_temperature :: double [R] The target temperature of this boiler prototyper or nil.
fluid :: LuaFluidPrototype [R] The fluid this offshore pump produces or nil.
pumping_speed :: double [R] The pumping speed of this offshore pump, normal pump, or nil.
stack :: boolean [R] If this inserter is a stack-type.
allow_custom_vectors :: boolean [R] If this inserter allows custom pickup and drop vectors.
count_as_rock_for_filtered_deconstruction :: boolean [R] If this simple-entity is counted as a rock for the deconstruction planner "trees and rocks only" filter.
filter_count :: uint [R] The filter count of this inserter, loader, or requester chest or nil.
production :: double [R] The max production this solar panel prototype produces or nil.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaEquipment - sort
name :: string [R] Name of this equipment.
type :: string [R] Type of this equipment.
position :: Position [R] Position of this equipment in the equipment grid.
shape [R] Shape of this equipment.
shield :: double [RW] Current shield value of the equipment.
max_shield :: double [R] Maximum shield value.
max_solar_power :: double [R] Maximum solar power generated.
movement_bonus :: double [R] Movement speed bonus.
generator_power :: double [R] Energy generated per tick.
energy :: double [RW] Current available energy.
max_energy :: double [R] Maximum amount of energy that can be stored in this equipment.
prototype :: LuaEquipmentPrototype [R]
burner :: LuaBurner [R] The burner energy source for this equipment or nil if there isn't one.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaEquipmentGrid - sort
take{position=…, equipment=…} → SimpleItemStack Remove an equipment from the grid.
take_all() → dictionary stringuint Remove all equipment from the grid.
clear() Clear all equipment from the grid.
put{name=…, position=…} → LuaEquipment Insert an equipment into the grid.
can_move{equipment=…, position=…} → boolean Check whether moving an equipment would succeed.
move{equipment=…, position=…} → boolean Move an equipment within this grid.
get(position) → LuaEquipment Find equipment in the Equipment Grid based off a position.
get_contents() → dictionary stringuint Get counts of all equipment in this grid.
prototype :: LuaEquipmentGridPrototype [R]
width :: uint [R] Width of the equipment grid.
height :: uint [R] Height of the equipment grid.
equipment :: array of LuaEquipment [R] All the equipment in this grid.
generator_energy :: double [R] Total energy per tick generated by the equipment inside this grid.
max_solar_energy :: double [R] Maximum energy per tick that can be created by any solar panels in the equipment grid.
available_in_batteries :: double [R] The total energy stored in all batteries in the equipment grid.
battery_capacity :: double [R] Total energy storage capacity of all batteries in the equipment grid.
shield :: float [R] The amount of shields this equipment grid has.
max_shield :: float [R] The maximum amount of shields this equipment grid has.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaEquipmentGridPrototype - sort
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
equipment_categories :: array of string [R] Equipment category names for the categories that may be inserted into this equipment grid.
width :: uint [R]
height :: uint [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaEquipmentPrototype - sort
name :: string [R] Name of this prototype.
type :: string [R] Type of this equipment prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
shape [R] Shape of this equipment prototype.
take_result :: LuaItemPrototype [R] The result item when taking this equipment out of an equipment grid.
energy_production :: double [R] The max power generated by this equipment.
shield :: float [R] The shield value of this equipment.
energy_per_shield :: double [R] The energy per shield point restored.
logistic_parameters [R] The logistic parameters for roboport equipment
energy_consumption :: double [R]
movement_bonus :: float [R]
night_vision_tint :: Color [R]
energy_source [R] The energy source prototype for the equipment.
equipment_categories :: array of string [R] Category names for this equipment.
burner_prototype :: LuaBurnerPrototype [R] The burner energy source prototype this equpment uses or nil.
electric_energy_source_prototype :: LuaElectricEnergySourcePrototype [R] The electric energy source prototype this equipment uses or nil.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaFlowStatistics - sort
get_input_count(string) Gets the total input count for a given prototype.
set_input_count(string, count) Sets the total input count for a given prototype.
get_output_count(string) Gets the total output count for a given prototype.
set_output_count(string, count) Sets the total output count for a given prototype.
on_flow(string, count) Adds a value to this flow statistics.
input_counts :: dictionary stringarray of uint64 or double [R] List of input counts indexed by name <> value.
output_counts :: dictionary stringarray of uint64 or double [R] List of output counts indexed by name <> value.
force :: LuaForce [R] The force these statistics belong to.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaFluidBox - sort
get_capacity(index) → double The capacity of the given fluidbox index.
get_connections() → array of LuaFluidBox The fluidbox connections for the given fluidbox index.
operator # :: uint [R] Number of fluid boxes.
owner :: LuaEntity [R] The entity that owns this fluidbox.
operator [] [R] Access, set or clear a fluid box.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaFluidPrototype - sort
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
default_temperature :: double [R] Default temperature of the fluid.
max_temperature :: double [R] Maximum temperature the fluid can reach.
heat_capacity :: double [R] How much energy the fluid will generate at max temperature assuming 100% efficiency steam engine.
pressure_to_speed_ratio :: double [R] How much pressure -- difference in fluid levels -- will be converted to speed.
flow_to_energy_ratio :: double [R] How much will a volume of fluid transferred be converted to energy.
max_push_amount :: double [R]
ratio_to_push :: double [R]
order :: string [R] Order string for this prototype.
group :: LuaGroup [R] Group of this prototype.
subgroup :: LuaGroup [R] Subgroup of this prototype.
base_color :: Color [R]
flow_color :: Color [R]
gas_temperature :: double [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaForce - sort
get_entity_count(name) → uint Count entities of given type.
disable_research() Disable research for this force.
enable_research() Enable research for this force.
disable_all_prototypes() Disable all recipes and technologies.
reset_recipes() Load the original version of all recipes from the prototypes.
enable_all_recipes() Unlock all recipes.
enable_all_technologies() Unlock all technologies.
research_all_technologies(include_disabled_prototypes) Research all technologies.
reset_technologies() Load the original versions of technologies from prototypes.
reset() Reset everything.
reset_technology_effects() Reapplies all possible research effects, including unlocked recipes.
chart(surface, area) Chart a portion of the map.
clear_chart(surface) Erases chart data for this force.
rechart() Force a rechart of the whole chart.
chart_all(surface) Chart all generated chunks.
is_chunk_charted(surface, position) → boolean Has a chunk been charted?
is_chunk_visible(surface, position) → boolean Is the given chunk currently charted and visible (not covered by fogg of war) on the map.
get_ammo_damage_modifier(ammo) → double
set_ammo_damage_modifier(ammo, modifier)
get_gun_speed_modifier(ammo) → double
set_gun_speed_modifier(ammo, modifier)
get_turret_attack_modifier(turret) → double
set_turret_attack_modifier(turret, modifier)
set_cease_fire(other, cease_fire) Stop attacking members of a given force.
get_cease_fire(other) → boolean Will this force attack members of another force?
set_friend(other, cease_fire) Friends have unrestricted access to buildings and turrets won't fire at them.
get_friend(other) → boolean Is this force a friend?
is_pathfinder_busy() → boolean Is pathfinder busy?
kill_all_units() Kill all units and flush the pathfinder.
find_logistic_network_by_position(position, surface) → LuaLogisticNetwork
set_spawn_position(position, surface)
get_spawn_position(surface) → Position
unchart_chunk(position, surface)
get_item_launched(item) → uint Gets the count of a given item launched in rockets.
set_item_launched(item, count) Sets the count of a given item launched in rockets.
print(message) Print text to the chat console of all players on this force.
get_trains(surface) → array of LuaTrain
add_chart_tag(surface, tag) → LuaCustomChartTag Adds a custom chart tag to the given surface and returns the new tag or nil if the given position isn't valid for a chart tag.
find_chart_tags(surface, area) → array of LuaCustomChartTag Finds all custom chart tags within the given bounding box on the given surface.
get_saved_technology_progress(technology) → double Gets the saved progress for the given technology or nil if there is no saved progress.
set_saved_technology_progress(technology, double) Sets the saved progress for the given technology.
name :: string [R] Name of the force.
technologies :: custom dictionary stringLuaTechnology [R] Technologies owned by this force, indexed by their name.
recipes :: custom dictionary stringLuaRecipe [R] Recipes available to this force, indexed by their name.
manual_mining_speed_modifier :: double [RW] Multiplier of the manual mining speed.
manual_crafting_speed_modifier :: double [RW] Multiplier of the manual crafting speed.
laboratory_speed_modifier :: double [RW]
worker_robots_speed_modifier :: double [RW]
worker_robots_battery_modifier :: double [RW]
worker_robots_storage_bonus :: double [RW]
current_research :: LuaTechnology or string [RW] The current research in progress.
research_progress :: double [RW] Progress of current research, as a number in range [0, 1].
inserter_stack_size_bonus :: double [RW] The inserter stack size bonus for non stack inserters
stack_inserter_capacity_bonus :: uint [RW] Number of items that can be transferred by stack inserters
character_logistic_slot_count :: double [RW] Number of character logistic slots.
character_trash_slot_count :: double [RW] Number of character trash slots.
quickbar_count :: uint [RW] Number of character quick bars.
maximum_following_robot_count :: uint [RW] Maximum number of follower robots.
ghost_time_to_live :: uint [RW] The time, in ticks, before a placed ghost disappears.
players :: array of LuaPlayer [R] Players belonging to this force.
ai_controllable :: boolean [RW] Enables some higher-level AI behaviour for this force.
logistic_networks :: dictionary stringarray of LuaLogisticNetwork [R] List of logistic networks, grouped by surface.
item_production_statistics :: LuaFlowStatistics [R] The item production statistics for this force.
fluid_production_statistics :: LuaFlowStatistics [R] The fluid production statistics for this force.
kill_count_statistics :: LuaFlowStatistics [R] The kill counter statistics for this force.
entity_build_count_statistics :: LuaFlowStatistics [R] The entity build statistics for this force (built and mined)
character_running_speed_modifier :: uint [RW]
character_build_distance_bonus :: uint [RW]
character_item_drop_distance_bonus :: uint [RW]
character_reach_distance_bonus :: uint [RW]
character_resource_reach_distance_bonus :: double [RW]
character_item_pickup_distance_bonus :: double [RW]
character_loot_pickup_distance_bonus :: double [RW]
character_inventory_slots_bonus :: uint [RW] the number of additional inventory slots the character main inventory has.
deconstruction_time_to_live :: uint [RW] The time, in ticks, before a deconstruction order is removed.
character_health_bonus :: float [RW]
auto_character_trash_slots :: boolean [RW] true if auto character trash slots are enabled.
zoom_to_world_enabled :: boolean [RW] Ability to use zoom-to-world on map.
zoom_to_world_ghost_building_enabled :: boolean [RW] Ability to build ghosts through blueprint or direct ghost placement, or "mine" ghosts when using zoom-to-world.
zoom_to_world_blueprint_enabled :: boolean [RW] Ability to create new blueprints using empty blueprint item when using zoom-to-world.
zoom_to_world_deconstruction_planner_enabled :: boolean [RW] Ability to use deconstruction planner when using zoom-to-world.
zoom_to_world_selection_tool_enabled :: boolean [RW] Ability to use custom selection tools when using zoom-to-world.
rockets_launched :: uint [RW] The number of rockets launched.
items_launched :: dictionary stringuint [R] All of the items that have been launched in rockets.
connected_players :: array of LuaPlayer [R] The connected players belonging to this force.
mining_drill_productivity_bonus :: double [RW]
train_braking_force_bonus :: double [RW]
evolution_factor :: float [RW] Evolution factor of this force.
friendly_fire :: boolean [RW] If friendly fire is enabled for this force.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaGameScript - sort
help() Internal
set_game_state{game_finished=…, player_won=…, next_level=…, can_continue=…} Set scenario state.
get_entity_by_tag(tag) → LuaEntity
show_message_dialog{text=…, image=…, point_to=…} Show an in-game message dialog.
disable_tips_and_tricks() Disable showing tips and tricks.
is_demo() → boolean Is this the demo version of Factorio?
reload_script() Forces a reload of the scenario script when the save game without the migration is loaded.
save_atlas() Saves the current configuration of Atlas to a file.
check_consistency() Run internal consistency checks.
regenerate_entity(entitites) Regenerate autoplacement of some entities on all surfaces.
take_screenshot{player=…, by_player=…, position=…, resolution=…, zoom=…, path=…, show_gui=…, show_entity_info=…, anti_alias=…} Take a screenshot and save it to a file.
write_file(filename, data, append, for_player) Write a string to a file.
remove_path(path) Remove file or directory.
remove_offline_players(players) Remove players who are currently not connected from the map.
force_crc() Force a CRC check.
create_force(force) → LuaForce Create a new force.
merge_forces(source, destination) Merge two forces together.
create_surface(name, settings) → LuaSurface Create a new surface
server_save(name) Instruct the server to save the map.
delete_surface(surface) Deletes the given surface and all entities on it.
disable_replay() Disables replay saving for the current save file.
direction_to_string(direction) Converts the given direction into the string version of the direction.
print(message) Print text to the chat console all players.
create_random_generator(seed) → LuaRandomGenerator Creates a deterministic standalone random generator with the given seed or if a seed is not provided the initial map seed is used.
check_prototype_translations() → boolean Goes over all items, entities, tiles, recipes, technologies among other things and logs if the locale is incorrect.
player :: LuaPlayer [R] The player typing at the console - nil in all other instances.
players :: custom dictionary uint or stringLuaPlayer [R]
map_settings :: MapSettings [R]
difficulty_settings :: DifficultySettings [R] Although it can be done; because different difficulties can have different technology or recipe trees it's not recomended to change difficulty settings mid-game.
difficulty :: defines.difficulty [R] Current scenario difficulty.
forces :: custom dictionary stringLuaForce [R]
entity_prototypes :: custom dictionary stringLuaEntityPrototype [R]
item_prototypes :: custom dictionary stringLuaItemPrototype [R]
fluid_prototypes :: custom dictionary stringLuaFluidPrototype [R]
tile_prototypes :: custom dictionary stringLuaTilePrototype [R]
equipment_prototypes :: custom dictionary stringLuaEquipmentPrototype [R]
damage_prototypes :: custom dictionary stringLuaDamagePrototype [R]
virtual_signal_prototypes :: custom dictionary stringLuaVirtualSignalPrototype [R]
equipment_grid_prototypes :: custom dictionary stringLuaEquipmentGridPrototype [R]
recipe_prototypes :: custom dictionary stringLuaRecipePrototype [R]
technology_prototypes :: custom dictionary stringLuaTechnologyPrototype [R]
decorative_prototypes :: custom dictionary stringLuaDecorativePrototype [R]
tick :: uint [R] Current map tick.
finished :: boolean [R] Is the scenario finished?
speed :: float [RW] Speed to update the map at.
surfaces :: custom dictionary stringLuaSurface [R]
active_mods :: dictionary stringstring [R] The active mods versions.
connected_players :: array of LuaPlayer [R] The online players This is primarally useful when you want to do some action against all online players.
permissions :: LuaPermissionGroups [R]
class LuaGroup - sort
name :: string [R]
type :: string [R]
group :: LuaGroup [R] The parent group if any; nil if none.
subgroups :: array of LuaGroup [R] Subgroups of this group.
order :: string [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaGui - sort
is_valid_sprite_path(sprite_path) → boolean Returns true if sprite_path is valid and contains loaded sprite, otherwise false.
player :: LuaPlayer [R] The player who owns this gui.
children :: dictionary stringLuaGuiElement [R] The children GUI elements mapped by name <> element.
top :: LuaGuiElement [R] The top part of the GUI.
left :: LuaGuiElement [R] The left part of the GUI.
center :: LuaGuiElement [R] The center part of the GUI.
goal :: LuaGuiElement [R] The flow used in the objectives window.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaGuiElement - sort
add{type=…, name=…, style=…} → LuaGuiElement Add a child element.
clear() Remove children of this element.
destroy() Remove this element, along with its children.
clear_items() Clears the items in this dropdown.
get_item(index) → LocalisedString Gets an item at the given index from this dropdown.
set_item(index, LocalisedString) Sets an item at the given index in this dropdown.
add_item(LocalisedString, index) Adds an item at the end or at the given index in this dropdown.
remove_item(index) Removes an item at the given index in this dropdown.
gui :: LuaGui [R] The GUI this element is a part of.
parent :: LuaGuiElement [R] The direct parent of this element; nil if this is a top-level element.
name :: string [R] The name of this element.
caption :: LocalisedString [RW] The text displayed on the element.
value :: double [RW] How much this progress bar is filled.
direction :: string [RW] Direction of the layout.
style :: LuaStyle or string [RW] The style of this element.
text :: string [RW] The text contained in a textfield or text-box.
children_names :: array of string [R] Names of all the children of this element.
state :: boolean [RW] Is this checkbox checked?
player_index :: uint [R] Index into LuaGameScript::players specifying the player who owns this element.
sprite :: SpritePath [RW] Path the the image to display on this sprite-button.
tooltip :: LocalisedString [RW]
vertical_scroll_policy :: string [RW] Allowed values are: "always", "never", or "auto"
horizontal_scroll_policy :: string [RW] Allowed values are: "always", "never", or "auto"
type :: string [R] The type of this GUI element.
children :: array of LuaGuiElement [R] The children elements
items :: array of LocalisedString [RW] The items in this dropdown.
selected_index :: uint [RW] The selected index for this dropdown.
single_line :: boolean [RW] If this label should render its contents on single line or multiple based off the max width of the label.
want_ellipsis :: boolean [RW] If this label text should render text outside the label area as ".
position :: Position [RW] The position this camera is focused on.
surface_index :: uint [RW] The surface index this camera is using.
zoom :: double [RW] The zoom this camera is using.
elem_type :: string [R] The elem type of this choose-elem-button.
elem_value :: string or SignalID [RW] The elem value of this choose-elem-button or nil if there is no value.
selectable :: boolean [RW] If the contents of this text-box are selectable.
word_wrap :: boolean [RW] If this text-box will word-wrap automatically.
read_only :: boolean [RW] If this text-box is read-only.
enabled :: boolean [RW] If this GUI element is enabled.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaInventory - sort
clear() Make this inventory empty.
can_insert(items) → boolean Can at least some items be inserted?
insert(items) → uint Insert items into this inventory.
remove(items) → uint Remove items from this inventory.
get_item_count(item) → uint Get the number of all or some items in this inventory.
is_empty() → boolean Does this inventory contain nothing?
get_contents() → dictionary stringuint Get counts of all items in this inventory.
hasbar() → boolean Does this inventory have a bar?
getbar() → uint Get the current bar.
setbar(bar) Set the current bar.
supports_filters() → boolean If this inventory supports filters.
is_filtered() → boolean If this inventory supports filters and has at least 1 filter set.
can_set_filter(index, filter) → boolean If the given inventory slot filter can be set to the given filter.
get_filter(index) → string Gets the filter for the given item stack index.
set_filter(index, filter) → boolean Sets the filter for the given item stack index.
find_item_stack(item) → LuaItemStack Gets the first LuaItemStack in the inventory that matches the given item name.
operator # :: uint [R] Get the number of slots in this inventory.
index :: uint [R] The inventory index this inventory uses.
entity_owner :: LuaEntity [R] The entity that owns this inventory or nil if this isn't owned by an entity.
player_owner :: LuaPlayer [R] The player that owns this inventory or nil if this isn't owned by a player.
equipment_owner :: LuaEntity [R] The equipment that owns this inventory or nil if this isn't owned by an equipment.
operator [] :: LuaItemStack [R] The indexing operator.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaItemPrototype - sort
has_flag(flag) → boolean Does this prototype have a flag enabled?
get_ammo_type(ammo_source_type) Type of this ammo prototype or nil if this is not an ammo prototype.
type :: string [R] Type of this prototype.
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
order :: string [R] Order string.
place_result :: LuaEntityPrototype [R] Prototype of the entity that will be created by placing this item, or nil if there is no such entity.
place_as_equipment_result :: LuaEquipmentPrototype [R] Prototype of the equipment that will be created by placing this item in an equipment grid or nil if there is no equipment defined.
place_as_tile_result [R] The place as tile result if one is defined else nil.
stackable :: boolean [R] Is this item allowed to stack at all?
default_request_amount :: uint [R] The default request value.
stack_size :: uint [R] Maximum stack size of the item specified by this prototype.
fuel_category :: string [R] The fuel category or nil.
burnt_result :: LuaItemPrototype [R] The result of burning this item as fuel or nil.
fuel_value :: float [R] Fuel value when burned.
fuel_acceleration_multiplier :: double [R] The acceleration multiplier when this item is used as fuel in a vehicle.
fuel_top_speed_multiplier :: double [R] The fuel top speed multiplier when this item is used as fuel in a vehicle.
subgroup :: LuaGroup [R] The subgroup this prototype belongs to.
group :: LuaGroup [R] The group this prototype belongs to.
flags :: dictionary stringboolean [R] The item prototype flags for this item prototype.
magazine_size :: float [R] Size of full magazine; nil if this is not an ammo item.
equipment_grid :: LuaEquipmentGridPrototype [R] The prototype of this armor equipment grid or nil if none or this is not an armor item.
resistances :: Resistances [R] Resistances of this armour item; nil if not an armor or or the armor has no resistances.
inventory_size_bonus :: uint [R] The invntory size bonus for this armor prototype.
capsule_action :: CapsuleAction [R] The capsule action for this capsule item prototype or nil if this isn't a capsule item prototype.
attack_parameters :: AttackParameters [R] The gun attack parameters or nil if not a gun item prototype.
inventory_size :: uint [R] The main inventory size for item-with-inventory-prototype.
item_filters :: dictionary stringLuaItemPrototype [R]
group_filters :: dictionary stringLuaGroup [R]
sub_group_filters :: dictionary stringLuaGroup [R]
filter_mode :: string [R] The filter mode used by this item with inventory.
insertion_priority_mode :: string [R] The insertion priority mode used by this item with inventory.
localised_filter_message :: LocalisedString [R] The localised string used when the player attempts to put items into this item with inventory that aren't allowed.
extend_inventory_by_default :: boolean [R] If this item with inventory extends the inventory it resides in by default.
default_label_color :: Color [R] The default label color used for this item with label.
draw_label_for_cursor_render :: boolean [R] If true, and this item with label has a label it is drawn in place of the normal number when held in the cursor.
speed :: float [R] Mining or repairing speed if this is a mining or repairing tool; otherwise nil.
attack_result :: array of TriggerItem [R] The attack result of this mining tool prototype.
attack_range :: float [R] The attack range of this mining tool or nil if not a mining tool.
module_effects :: dictionary stringEffectValue [R] Effects of this module; nil if this is not a module.
category :: string [R] The module category name
tier :: float [R] The module tier
limitations :: array of string [R] An array of recipe names this module is allowed to work with.
limitation_message_key :: string [R] The limitation message key used when the player attempts to use this modules in some place it's not allowed.
straight_rail :: LuaEntityPrototype [R] The straight rail prototype used for this rail planner prototype.
curved_rail :: LuaEntityPrototype [R] The curved rail prototype used for this rail planner prototype.
repair_result :: array of TriggerItem [R] The repair result of this repair tool prototype or nil if this isn't a repair tool prototype.
selection_border_color :: Color [R] The color used when doing normal selection with this selection tool prototype.
alt_selection_border_color :: Color [R] The color used when doing alt selection with this selection tool prototype.
selection_mode_flags :: SelectionModeFlags [R] Flags that affect which entities will be selected.
alt_selection_mode_flags :: SelectionModeFlags [R] Flags that affect which entities will be selected during alternate selection.
selection_cursor_box_type :: string [R]
alt_selection_cursor_box_type :: string [R]
always_include_tiles :: boolean [R] If tiles area always included when doing selection with this selection tool prototype.
entity_filter_slots :: uint [R] The number of entity filters this deconstruction item has or nil if this isn't a deconstruction item prototype.
tile_filter_slots :: uint [R] The number of tile filters this deconstruction item has or nil if this isn't a deconstruction item prototype.
durability_description_key :: string [R] The durability message key used when displaying the durability of this tool.
durability :: double [R] The durability of this tool item or nil if not a tool item.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaItemStack - sort
is_blueprint_setup() → boolean Is this blueprint item setup?
get_blueprint_entities() → array of blueprint entity Entities in this blueprint.
set_blueprint_entities(entities) Set new entities to be a part of this blueprint.
add_ammo(amount) Add ammo to this ammo item.
drain_ammo(amount) Remove ammo from this ammo item.
add_durability(amount) Add durability to this tool item.
drain_durability(amount) Remove durability from this tool item.
can_set_stack(stack) → boolean Would a call to LuaItemStack::set_stack succeed?
set_stack(stack) → boolean Set this item stack to another item stack.
clear() Clear this item stack.
get_blueprint_tiles() → array of blueprint tile Tiles in this blueprint
set_blueprint_tiles(tiles) Set tiles in this blueprint
get_inventory(inventory) → LuaInventory Access the inner inventory of an item.
build_blueprint{surface=…, force=…, position=…, force_build=…, direction=…} → array of LuaEntity Build this blueprint
create_blueprint{surface=…, force=…, area=…, always_include_tiles=…} Sets up this blueprint using the found blueprintable entities/tiles on the surface.
get_tag(tag_name) → Any Gets the tag with the given name or returns nil if it doesn't exist.
set_tag(tag_name, tag) → Any Sets the tag with the given name and value.
remove_tag() → boolean Removes a tag with the given name.
clear_blueprint() Clears this blueprint item.
get_entity_filter(index) → string Gets the entity filter at the given index for this deconstruction item.
set_entity_filter(index, filter, DeconstructionItem) → boolean Sets the entity filter ata the given index for this deconstruction item.
get_tile_filter(index) → string Gets the tile filter at the given index for this deconstruction item.
set_tile_filter(index, filter, DeconstructionItem) → boolean Sets the tile filter ata the given index for this deconstruction item.
clear_deconstruction_item() Clears all settings/filters on this deconstruction item resetting it to default values.
valid_for_read :: boolean [R] Is this valid for reading?
prototype :: LuaItemPrototype [R] Prototype of the item held in this stack.
name :: string [R] Prototype name of the item held in this stack.
type :: string [R] Type of the item prototype.
count :: uint [RW] Number of items in this stack.
grid :: LuaEquipmentGrid [R] The equipment grid of this item or nil if this item doesn't have a grid.
health :: float [RW] How much health the item has, as a number in range [0, 1].
durability :: double [RW] Durability of the contained item.
ammo :: uint [RW] Number of bullets left in the magazine.
blueprint_icons :: array of Icon [RW] Icons of a blueprint item.
label :: string [RW] The current label for this item.
label_color :: Color [RW] The current label color for this item.
allow_manual_label_change :: boolean [RW] If the label for this item can be manually changed.
cost_to_build :: dictionary stringuint [R] Raw materials required to build this blueprint.
extends_inventory :: boolean [RW] If this item extends the inventory it resides in (provides its contents for counts, crafting, insertion).
prioritize_insertion_mode :: string [RW] The insertion mode priority this ItemWithInventory uses when items are inserted into an inventory it resides in.
default_icons :: array of Icon [R] The default icons for a blueprint item.
tags :: dictionary stringAny [RW]
custom_description :: LocalisedString [RW] The custom description this item-with-tags.
entity_filters :: array of string [RW] The entity filters for this deconstruction item.
tile_filters :: array of string [RW] The tile filters for this deconstruction item.
entity_filter_mode :: defines.deconstruction_item.entity_filter_mode [RW] The blacklist/whitelist entity filter mode for this deconstruction item.
tile_filter_mode :: defines.deconstruction_item.tile_filter_mode [RW] The blacklist/whitelist tile filter mode for this deconstruction item.
tile_selection_mode :: defines.deconstruction_item.tile_filter_mode [RW] The tile selection mode for this deconstruction item.
trees_and_rocks_only :: boolean [RW] If this deconstruction item is set to allow trees and rocks only.
entity_filter_count :: uint [R] The number of entity filters this deconstruction item supports.
tile_filter_count :: uint [R] The number of tile filters this deconstruction item supports.
active_index :: uint [RW] The active blueprint index for this blueprint book.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaLogisticCell - sort
is_in_logistic_range(position) → boolean Is a given position within the logistic range of this cell?
is_in_construction_range(position) → boolean Is a given position within the construction range of this cell?
is_neighbour_with(other) → boolean Are two cells neighbours?
logistic_radius :: float [R] Logistic radius of this cell.
construction_radius :: float [R] Construction radius of this cell.
stationed_logistic_robot_count :: uint [R] Number of stationed logistic robots in this cell.
stationed_construction_robot_count :: uint [R] Number of stationed construction robots in this cell.
mobile :: boolean [R] true if this is a mobile cell.
transmitting :: boolean [R] true if this cell is active.
charge_approach_distance :: float [R] Radius at which the robots hover when waiting to be charged.
charging_robot_count :: uint [R] Number of robots currently charging.
to_charge_robot_count :: uint [R] Number of robots waiting to charge.
owner :: LuaEntity [R] This cell's owner.
logistic_network :: LuaLogisticNetwork [R] The network that owns this cell or nil.
neighbours :: array of LuaLogisticCell [R] Neighbouring cells.
charging_robots :: array of LuaEntity [R] Robots currently being charged.
to_charge_robots :: array of LuaEntity [R] Robots waiting to charge.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaLogisticNetwork - sort
get_item_count(item, member) → uint Count given or all items in the network or given members.
get_contents() → dictionary stringuint Get item counts for the entire network.
remove_item(item, members) → uint Remove items from the logistic network.
insert(item, members) → uint Insert items into the logistic network.
find_cell_closest_to(position) → LuaLogisticCell Find logistic cell closest to a given position.
available_logistic_robots :: uint [R] Number of logistic robots available for a job.
all_logistic_robots :: uint [R] The total number of logistic robots in the network (idle and active + in roboports).
available_construction_robots :: uint [R] Number of construction robots available for a job.
all_construction_robots :: uint [R] The total number of construction robots in the network (idle and active + in roboports).
robot_limit :: uint [R] Maximum number of robots the network can work with.
cells :: array of LuaLogisticCell [R] All cells in this network.
providers :: array of LuaEntity [R] All entities that have logistic provider points in this network.
empty_providers :: array of LuaEntity [R] All entities that have empty logistic provider points in this network.
requesters :: array of LuaEntity [R] All entities that have logistic requester points in this network.
full_or_satisfied_requesters :: array of LuaEntity [R] All entities that have full or satisfied logistic requester points in this network.
storages :: array of LuaEntity [R] All entities that have logistic storage points in this network.
logistic_members :: array of LuaEntity [R] All other entities that have logistic points in this network (inserters mostly).
provider_points :: array of LuaLogisticPoint [R] All things that have provider points in this network.
empty_provider_points :: array of LuaLogisticPoint [R] All things that have empty provider points in this network.
requester_points :: array of LuaLogisticPoint [R] All things that have requester points in this network.
full_or_satisfied_requester_points :: array of LuaLogisticPoint [R] All things that have full or satisfied requester points in this network.
storage_points :: array of LuaLogisticPoint [R] All things that have storage points in this network.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaLogisticPoint - sort
owner :: LuaEntity [R] The LuaEntity owner of this LuaLogisticPoint.
logistic_network :: LuaLogisticNetwork [R]
logistic_member_index :: uint [R] The Logistic member index of this logistic point.
filters :: array of LogisticFilter [R] The logistic filters for this logistic point or nil if this doesn't use logistic filters.
mode :: defines.logistic_mode [R] The logistic mode.
force :: LuaForce [R] The force of this logistic point.
targeted_items_pickup :: dictionary stringuint [R] Items targeted to be picked up from this logistic point by robots.
targeted_items_deliver :: dictionary stringuint [R] Items targeted to be dropped off into this logistic point by robots.
exact :: boolean [R] If this logistic point is using the exact mode.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaPermissionGroup - sort
add_player(player) → boolean Adds the given player to this group.
remove_player(player) → boolean Removes the given player from this group.
allows_action(action) → boolean If this group allows the given action.
set_allows_action(action, boolean) → boolean Sets if the player is allowed to perform the given action.
destroy() → boolean Destroys this group.
name :: string [RW] The name of this group.
players :: array of LuaPlayer [R] The players in this group.
group_id :: uint [R] The group ID
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaPermissionGroups - sort
create_group(name) → LuaPermissionGroup Creates a new permission group.
get_group(group) → LuaPermissionGroup Gets the permission group with the given name or group ID or nil if there is no matching group.
groups :: array of LuaPermissionGroup [R] All of the permission groups.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaPlayer extends LuaControl - sort
set_ending_screen_data(message, file) Setup the screen to be shown when the game is finished.
print(message) Print text to the chat console.
clear_console() Clear the chat console.
get_goal_description() → LocalisedString Get the current goal description, as a localised string.
set_goal_description(text, only_update) Set the text in the goal window (top left).
set_controller{type=…, character=…} Set the controller type of the player.
disable_recipe_groups() Disable recipe groups.
disable_recipe_subgroups() Disable recipe subgroups.
print_entity_statistics(entities) Print entity statistics to the player's console.
unlock_achievement(name) Unlock the achievements of the given player.
clean_cursor() → boolean Invokes the "clean cursor" action on the player as if the user pressed it.
create_character(character) Creates and attaches a character entity to this player.
add_alert(entity, type) Adds an alert to this player for the given entity of the given alert type.
add_custom_alert(entity, icon, message, show_on_map) Adds a custom alert to this player.
remove_alert{entity=…, prototype=…, position=…, type=…, surface=…, icon=…, message=…} Removes all alerts matching the given filters or if an empty filters table is given all alerts are removed.
get_alerts{entity=…, prototype=…, position=…, type=…, surface=…} → dictionary uintdictionary defines.alert_typearray of alert Gets all alerts matching the given filters or if no filters are given all alerts are returned.
mute_alert(alert_type) → boolean Mutes alerts for the given alert category.
unmute_alert(alert_type) → boolean Unmutes alerts for the given alert category.
is_alert_muted(alert_type) → boolean If the given alert type is currently muted.
enable_alert(alert_type) → boolean Enables alerts for the given alert category.
disable_alert(alert_type) → boolean Disables alerts for the given alert category.
is_alert_enabled(alert_type) → boolean If the given alert type is currently enabled.
character :: LuaEntity [RW] The character attached to this player, or nil if no character.
index :: uint [R] This player's index in LuaGameScript::players.
gui :: LuaGui [R]
opened_self :: boolean [R] true if the player opened itself.
controller_type :: defines.controllers [R]
game_view_settings :: GameViewSettings [RW] The player's game view settings.
minimap_enabled :: boolean [RW] true if the minimap is visible.
color :: Color [RW] The colour associated with the player.
name :: string [RW] The player's username.
tag :: string [RW] The tag that is shown after the player in chat and on the map.
connected :: boolean [R] true if the player is currently connected to the game.
admin :: boolean [R] true if the player is an admin.
entity_copy_source :: LuaEntity [R] The source entity used during entity settings copy-paste if any.
afk_time :: uint [R] How many ticks since the last action of this player
online_time :: uint [R] How many ticks did this player spend playing this save (all sessions combined)
permission_group :: LuaPermissionGroup [RW] The permission group this player is part of or nil if not part of any group.
mod_settings [R]
zoom :: double [W] The player's zoom-level.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaRandomGenerator - sort
operator ()(lower, upper) → double Generates a random number.
re_seed(seed) Re-seeds the random generator with the given value.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaRecipe - sort
reload() Reload the recipe from the prototype.
name :: string [R] Name of the recipe.
localised_name :: LocalisedString [R] Localised name of the recipe.
localised_description :: LocalisedString [R]
prototype :: LuaRecipePrototype [R] The prototype for this recipe.
enabled :: boolean [RW] Can the recipe be used?
category :: string [R] Category of the recipe.
ingredients :: array of Ingredient [R] Ingredients for this recipe.
products :: array of Product [R] The results of this recipe.
hidden :: boolean [R] Is the recipe hidden?
energy :: double [R] Energy required to execute this recipe.
order :: string [R] Order string.
group :: LuaGroup [R] Group of this recipe.
subgroup :: LuaGroup [R] Subgroup of this recipe.
force :: LuaForce [R] The force that owns this recipe.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaRecipePrototype - sort
enabled :: boolean [R] If this recipe prototype is enabled by default (enabled at the begining of a game).
name :: string [R] Name of the recipe.
localised_name :: LocalisedString [R] Localised name of the recipe.
localised_description :: LocalisedString [R]
category :: string [R] Category of the recipe.
ingredients :: array of Ingredient [R] Ingredients for this recipe.
products :: array of Product [R] The results of this recipe.
hidden :: boolean [R] Is the recipe hidden?
energy :: double [R] Energy required to execute this recipe.
order :: string [R] Order string.
group :: LuaGroup [R] Group of this recipe.
subgroup :: LuaGroup [R] Subgroup of this recipe.
request_paste_multiplier :: uint [R] The multiplier used when this recipe is copied from an assembling machine to a requester chest.
overload_multiplier :: uint [R] Used to determine how many extra items are put into an assembling machine before it's considered "full enough".
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaRemote - sort
add_interface(name, functions) Add a remote interface.
remove_interface(name) → boolean Removes an interface with the given name.
call(interface, function, ...) Call a function of an interface.
interfaces :: dictionary stringdictionary stringboolean [R] List of all registered interfaces.
class LuaSettings - sort
get_player_settings(LuaPlayer)
startup :: custom dictionary stringModSetting [R]
global :: custom dictionary stringModSetting [R]
player :: custom dictionary stringModSetting [R]
class LuaStyle - sort
gui :: LuaGui [R] Gui of the LuaGuiElement of this style.
name :: string [R] Name of this style.
minimal_width :: int [RW]
maximal_width :: int [RW]
minimal_height :: int [RW]
maximal_height :: int [RW]
top_padding :: int [RW]
right_padding :: int [RW]
bottom_padding :: int [RW]
left_padding :: int [RW]
font_color :: Color [RW]
font :: string [RW]
cell_spacing :: int [RW] Space between the table cell contents and border.
visible :: boolean [RW] When not visible the GUI element is hidden completely and takes no space in the layout.
hovered_font_color :: Color [RW]
clicked_font_color :: Color [RW]
disabled_font_color :: Color [RW]
pie_progress_color :: Color [RW]
max_on_row :: int [RW]
resize_row_to_width :: boolean [RW]
resize_to_row_height :: boolean [RW]
horizontal_spacing :: int [RW] Horizontal space between individual cells.
vertical_spacing :: int [RW] Vertical space between individual cells.
title_top_padding :: uint [RW]
title_right_padding :: uint [RW]
title_bottom_padding :: uint [RW]
title_left_padding :: uint [RW]
selection_background_color :: Color [RW] The background color when selecting text.
smooth_size :: uint [RW]
smooth_color :: Color [RW]
diode_count :: uint [RW]
column_alignments :: custom array of Alignment [R] Alignments of columns of the table
horizontal_scrollbar_spacing :: int [RW]
vertical_scrollbar_spacing :: int [RW]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaSurface - sort
get_pollution(position) → double Get the pollution for a given position.
can_place_entity{name=…, position=…, direction=…, force=…} → boolean Check for collisions with terrain or other entities.
find_entity(entity, position) → LuaEntity Find a specific entity at a specific position.
find_entities(area) → array of LuaEntity Find entities in a given area.
find_entities_filtered{area=…, position=…, name=…, type=…, force=…, limit=…} → array of LuaEntity Find entities of given type or name in a given area.
count_entities_filtered{area=…, position=…, name=…, type=…, force=…, limit=…} → uint Count entities of given type or name in a given area.
find_non_colliding_position(name, center, radius, precision) → Position Find a non-colliding possition within a given rectangle.
spill_item_stack(position, items, enable_looted) Spill items on the ground centered at a given location.
find_enemy_units(center, radius, force) → array of LuaEntity Find units enemy of a given force within an area.
find_nearest_enemy{position=…, max_distance=…, force=…} → LuaEntity Find the enemy closest to the given position.
set_multi_command{command=…, unit_count=…, force=…, unit_search_distance=…} → uint Give a command to multiple units.
create_entity{name=…, position=…, direction=…, force=…, target=…, source=…, fast_replace=…, player=…, spill=…} → LuaEntity Create an entity on this surface.
create_unit_group{position=…, force=…} → LuaUnitGroup Create a new unit group at a given position.
build_enemy_base(position, unit_count, force) Send a group to build a new base.
get_tile(x, y) → LuaTile Get the tile at a given position.
set_tiles(tiles, correct_tiles) Set tiles at specified locations.
pollute(source, amount) Spawn pollution at the given position.
get_chunks() → LuaChunkIterator Get an iterator going over every chunk on this surface.
is_chunk_generated(position) → boolean Is a given chunk generated?
request_to_generate_chunks(position, radius) Request that the game's map generator generate chunks at the given position for the given radius on this surface.
set_chunk_generated_status(position, status) Set generated status of a chunk.
find_logistic_network_by_position(position, force) → LuaLogisticNetwork Find the logistic network that covers a given position.
find_logistic_networks_by_construction_area(position, force) → array of LuaLogisticNetwork Finds all of the logistics networks whos construction area intersects with the given position.
deconstruct_area{area=…, force=…} Place a deconstruction request.
cancel_deconstruct_area{area=…, force=…} Cancel a deconstruction order.
get_hidden_tile(position) The hidden tile name or nil if there isn't one for the given position.
get_connected_tiles(position, tiles) → array of Position Gets all tiles of the given types that are connected horizontally or vertically to the given tile position including the given tile position.
delete_chunk(position)
regenerate_entity(entitites, chunks) Regenerate autoplacement of some entities on this surface.
regenerate_decorative(decoratives, chunks) Regenerate autoplacement of some decoratives on this surface.
print(message) Print text to the chat console of all players on this surface.
destroy_decoratives(area) Removes all decoratives from the given area.
create_decoratives{check_collision=…, decoratives=…} Adds the given decoratives to the surface.
get_trains(force) → array of LuaTrain
clear_pollution() Clears all pollution on this surface.
name :: string [R] The name of this surface.
index :: uint [R] Unique ID associated with this surface.
map_gen_settings :: MapGenSettings [R] Gets the generation settings for the surface.
always_day :: boolean [RW] When set to true, the sun will always shine.
daytime :: float [RW] Current time of day, as a number in range [0, 1).
darkness :: float [R] Amount of darkness at the current time.
wind_speed :: float [RW] Current wind speed.
wind_orientation :: float [RW] Current wind direction.
wind_orientation_change :: float [RW] Change in wind orientation per tick.
peaceful_mode :: boolean [RW] Is peaceful mode enabled on this surface?
freeze_daytime :: boolean [RW] True if daytime is currently frozen.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTechnology - sort
reload() Reload this technology from its prototype.
force :: LuaForce [R] The force this technology belongs to.
name :: string [R] Name of this technology.
localised_name :: LocalisedString [R] Localised name of this technology.
localised_description :: LocalisedString [R]
prototype :: LuaTechnologyPrototype [R] The prototype of this technology.
enabled :: boolean [RW] Can this technology be researched?
upgrade :: boolean [R] Is this an upgrade-type research?
researched :: boolean [RW] Has this technology been researched?
prerequisites :: dictionary stringLuaTechnology [R] Prerequisites of this technology.
research_unit_ingredients :: array of Ingredient [R] Ingredients labs will require to research this technology.
effects :: array of Modifier [R] Effects applied when this technology is researched.
research_unit_count :: uint [R] Number of research units required for this technology.
research_unit_energy :: double [R] Amount of energy required to finish a unit of research.
order :: string [R] Order string for this prototype.
level :: uint [RW] The current level of this technology.
research_unit_count_formula :: string [R] The count forumula used for this infinite research or nil if this isn't an infinite research.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTechnologyPrototype - sort
name :: string [R] Name of this technology.
localised_name :: LocalisedString [R] Localised name of this technology.
localised_description :: LocalisedString [R]
enabled :: boolean [R] If this technology prototype is enabled by default (enabled at the begining of a game).
upgrade :: boolean [R] If the is technology prototype is an upgrade to some other technology.
prerequisites :: dictionary stringLuaTechnologyPrototype [R] Prerequisites of this technology.
research_unit_ingredients :: array of Ingredient [R] Ingredients labs will require to research this technology.
effects :: array of Modifier [R] Effects applied when this technology is researched.
research_unit_count :: uint [R] Number of research units required for this technology.
research_unit_energy :: double [R] Amount of energy required to finish a unit of research.
order :: string [R] Order string for this prototype.
level :: uint [R] The level of this research.
max_level :: uint [R] The max level of this research.
research_unit_count_formula :: string [R] The count forumula used for this infinite research or nil if this isn't an infinite research.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTile - sort
collides_with(layer) What type of things can collide with this tile?
name :: string [R] Prototype name of this tile.
prototype :: LuaTilePrototype [R]
position :: Position [R] The position this tile references.
hidden_tile :: string (optional) [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTilePrototype - sort
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
collision_mask :: dictionary stringboolean [R] The collison mask this tile uses The boolean values for each item are meaningless and will always be true.
layer :: uint [R]
walking_speed_modifier :: float [R]
vehicle_friction_modifier :: float [R]
map_color :: Color [R]
decorative_removal_probability :: float [R] The probability that decorative entities will be removed from on top of this tile when this tile is generated.
allowed_neighbors :: dictionary stringLuaTilePrototype [R]
mineable_properties [R]
items_to_place_this :: dictionary stringLuaItemPrototype [R] Items that when placed will produce this tile.
can_be_part_of_blueprint :: boolean [R] False if this tile is not allowed in blueprints regardless of the ability to build it.
emissions_per_tick :: double [R] Amount of pollution emissions per tick this tile will absorb.
autoplace_specification :: AutoplaceSpecification [R] Autoplace specification for this prototype.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTrain - sort
get_item_count(item) → uint Get the amount of a particular item stored in the train.
get_contents() → dictionary stringuint Get a mapping of the train's inventory.
remove_item(stack) → uint Remove some items from the train.
insert(stack) Insert a stack into the train.
clear_items_inside() Clear all items in this train.
recalculate_path(force) → boolean Checks if the path is invalid and tries to re-path if it isn't.
get_fluid_count(fluid) → double Get the amount of a particular fluid stored in the train.
get_fluid_contents() → dictionary stringdouble Gets a mapping of the train's fluid inventory.
remove_fluid(fluid) → double Remove some fluid from the train.
insert_fluid(fluid) → double Inserts the given fluid into the first available location in this train.
clear_fluids_inside() Clears all fluids in this train.
manual_mode :: boolean [RW] When true, the train is explicitly controlled by the player or script.
speed :: double [RW] Current speed.
carriages :: array of LuaEntity [R] Rolling stocks the train is composed of.
locomotives :: dictionary stringarray of LuaEntity [R] Arrays of locomotives.
cargo_wagons :: array of LuaEntity [R] The cargo carriages the train contains.
fluid_wagons :: array of LuaEntity [R] The fluid carriages the train contains.
schedule :: TrainSchedule [RW] The trains current schedule.
state :: defines.train_state [R] This train's current state.
front_rail :: LuaEntity [R] The rail at the front end of the train, possibly nil.
back_rail :: LuaEntity [R] The rail at the back end of the train, possibly nil.
rail_direction_from_front_rail :: defines.rail_direction [R]
rail_direction_from_back_rail :: defines.rail_direction [R]
front_stock :: LuaEntity [R] The front stock of this train or nil.
back_stock :: LuaEntity [R] The back stock of this train or nil.
station :: LuaEntity [R] The train stop this train is stopped at or nil.
has_path :: boolean [R] If this train has a path.
path_end_rail :: LuaEntity [R] The destination rail this train is currently pathing to or nil.
path_end_stop :: LuaEntity [R] The destination train stop this train is currently pathing to or nil.
id :: uint [R] The unique train ID.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaTransportLine - sort
clear() Remove all items from this transport line.
get_item_count(item) → uint Count some or all items on this line.
remove_item(items) → uint Remove some items from this line.
can_insert_at(position) → boolean Can an item be inserted at a given position?
can_insert_at_back() → boolean Can an item be inserted at the back of this line?
insert_at(position, items) → boolean Insert items at a given position.
insert_at_back(items) → boolean Insert items at the back of this line.
get_contents() → dictionary stringuint Get counts of all items on this line.
operator # :: uint [R] Get the number of items on this transport line.
owner :: LuaEntity [R] The entity this transport line belongs to.
operator [] :: LuaItemStack [R] The indexing operator.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaUnitGroup - sort
add_member(unit) Make a unit a member of this group.
set_command(command) Give this group a command.
set_autonomous() Make this group autonomous.
start_moving() Make the group start moving even if some of its members haven't yet arrived.
destroy() Dissolve this group.
members :: array of LuaEntity [R] Members of this group.
position :: Position [R] Group position.
state :: defines.group_state [R] Whether this group is gathering, moving or attacking.
force :: LuaForce [R] The force of this unit group.
surface :: LuaSurface [R] The surface of this unit group.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.
class LuaVirtualSignalPrototype - sort
name :: string [R] Name of this prototype.
order :: string [R] Order string of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
special :: boolean [R] If this is a special signal
subgroup :: LuaGroup [R]
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.