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:

class LuaFlowStatistics - sort
get_input_count(name) → 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.
get_output_count(name) → 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.
input_counts :: dictionary[stringuint64 or double] [R] List of input counts indexed by prototype name.
output_counts :: dictionary[stringuint64 or double] [R] List of output counts indexed by prototype name.
force :: LuaForce [R] The force these statistics belong to or nil for pollution statistics.
valid :: boolean [R] Is this object valid?
object_name :: string [R] The class name of this object.
help() → string All methods and properties that this object supports.
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 :: defines.flow_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.

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

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-only]

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-only]

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