Factorio API Docs

1.1.51 <>

Class LuaFlowStatistics

Encapsulates statistic data for different parts of the game. In the context of flow statistics, input and output describe on which side of the associated GUI the values are shown. Input values are shown on the left side, output values on the right side.

Examples:
- The item production GUI shows "consumption" on the right, thus output describes the item consumption numbers. The same goes for fluid consumption.
- The kills gui shows "losses" on the right, so output describes how many of the force's entities were killed by enemies.
- The electric network GUI shows "power consumption" on the left side, so in this case input describes the power consumption numbers.

uint64 or double

Gets the total input count for a given prototype.


set_input_count(name, count)

Sets the total input count for a given prototype.


uint64 or double

Gets the total output count for a given prototype.


set_output_count(name, count)

Sets the total output count for a given prototype.


get_flow_count{name, input, precision_index, count}
double

Gets the flow count value for the given time frame.


on_flow(name, count)

Adds a value to this flow statistics.


clear()

Reset all the statistics data to 0.


help()
string

All methods and properties that this object supports.


:: dictionary[stringuint64 or double]
[R]

List of input counts indexed by prototype name.


:: dictionary[stringuint64 or double]
[R]

List of output counts indexed by prototype name.


[R]

The force these statistics belong to or nil for pollution statistics.


:: boolean
[R]

Is this object valid?


:: string
[R]

The class name of this object.

Methods

get_input_count (name) → uint64 or double

Gets the total input count for a given prototype.

Parameters

name
:: string

The prototype name.


set_input_count (name, count)

Sets the total input count for a given prototype.

Parameters

name
:: string

The prototype name.


count
:: uint64 or double

The new count. The type depends on the instance of the statistics.


get_output_count (name) → uint64 or double

Gets the total output count for a given prototype.

Parameters

name
:: string

The prototype name.


set_output_count (name, count)

Sets the total output count for a given prototype.

Parameters

name
:: string

The prototype name.


count
:: uint64 or double

The new count. The type depends on the instance of the statistics.


get_flow_count {name, input, precision_index, count} → double

Gets the flow count value for the given time frame.

Parameters

Table with the following fields:
name
:: string

The prototype name.


input
:: boolean

Read the input values or the output values


precision_index

The precision to read.


count
:: boolean
Optional

If true, the count is returned instead of the per-time-frame value.


on_flow (name, count)

Adds a value to this flow statistics.

Parameters

name
:: string

The prototype name.


count
:: float

The count: positive or negative determines if the value goes in the input or output statistics.


clear ()

Reset all the statistics data to 0.


help () → string

All methods and properties that this object supports.

Attributes

input_counts :: dictionary[stringuint64 or double] [Read]

List of input counts indexed by prototype name. Represents the data that is shown on the left side of the GUI for the given statistics.


output_counts :: dictionary[stringuint64 or double] [Read]

List of output counts indexed by prototype name. Represents the data that is shown on the right side of the GUI for the given statistics.


force :: LuaForce [Read]

The force these statistics belong to or nil for pollution statistics.


valid :: boolean [Read]

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.


object_name :: string [Read]

The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

|<

Classes

Events

Concepts

Defines

Builtin types

>|