Skip to content

RitnProtoUtilityConst

Data-stage manipulator for data.raw["utility-constants"].default[<key>]. Special case: these constants are nested under .default (unlike other prototypes at data.raw[type][name]), so the class overrides :update(). Inherits from RitnPrototype.

Warning — Factorio 1.x API: this class hasn't been revised since Factorio 2.0. Usable but not validated for 2.0 — see Factorio 2.0 migration.

Source classes/prototypes/UtilityConstants.lua
Stage data
Access require(ritnlib.defines.class.prototype.utility.constants)
Inherits from RitnPrototype
object_name "RitnProtoUtilityConst"

Constructor

RitnProtoUtilityConst(constant_name)RitnProtoUtilityConst

Deep-copies data.raw["utility-constants"].default[constant_name] into prototype if it exists.

Parameters - constant_name :: string — constant key under default.


Methods

:setValue(value)RitnProtoUtilityConst

Replaces the constant's value entirely with value (overwrites prototype), then :update().

Parameters: value :: any.

:update()

Override: writes back to data.raw["utility-constants"].default[<name>] (the .default[] indirection vs the base RitnPrototype:update).

The other generic mutators are inherited from RitnPrototype.


Usage example

local RitnProtoUtilityConst = require(ritnlib.defines.class.prototype.utility.constants)
RitnProtoUtilityConst("chart"):setValue(myChartConstants)

See also