Setting

Setting

class

Configurable game setting

  • load-only Usable only while mods load. The game seals these members once loading finishes, so a call or a write from a running world raises an error.

Fields

NameTypeDescription
restart boolean Changing this setting requires a restart
set_action function Called with the new value when the setting changes
label string Localization key of the displayed name
type string Widget type used to edit the setting
category string Settings category this entry belongs to
value boolean|integer|string|nil Current value: a boolean for Bool, an integer for Slider and Int, a string for String and Buttons
default boolean|integer|string|nil Default value, of the same kind as value
options string[] Values a String or Buttons setting offers
min integer Lower bound of a Slider or Int value
max integer Upper bound of a Slider or Int value
bool_value boolean Current boolean value
bool_default_value boolean Default boolean value
string_value string Current string value
default_string_value string Default string value
string_options string[] Allowed string values
int_value integer Current integer value
int_default_value integer Default integer value
max_value integer Upper bound of the integer value
min_value integer Lower bound of the integer value
key_binding string Input action bound to this setting
default_key string Default keystroke, e.g. Ctrl+Shift+F
key_action function Called with this setting when the bound key goes down; only for a key_binding of this mod's own

Functions

Setting.update_widgets()

Refresh every settings widget from the current values

Standard members (5)

These members are available on all classes of this kind.

Setting.cast(object) Trying to cast Object into Setting
Setting.get_class() Return Setting class object
Setting.find(name) Looks Setting up in db, nil when there is none
Setting.get(name) Takes Setting from db, reports a miss to the log
Setting.reg(name, spec) load-only Register a new Setting static object, or take the registered one of that name
Inherited from Prototype (2)
Inherited from Object (1)