setting

inline fun <T> setting(default: T, prefix: String = ""): SettingDelegate<T>

Creates a property delegate that represents the value of the corresponding mindustry setting.

The returned delegate must be used only for one property, using the same setting delegate on multiple properties will result in undefined behaviour.

The name of the setting this delegate is bound to is determined by the name of the property, converted to kebab-case. In addiction, if prefix doesn't end with '-' or '.', a '.' is prepended. E.g.

var isCoolFeatureEnabled by setting(false, "coolMod")

delegates to a setting named "coolMod.is-cool-feature-enabled".

Parameters

default

a default value returned when the setting is absent in the map or its type is different from T.

prefix

a string prepended to the name of the property.


inline fun <T> setting(default: T, noinline lazyPrefix: () -> String?): SettingDelegate<T>

Creates a property delegates that delegates to a mindustry setting.

Unlike the delegate returned by setting, this one computes the prefix lazily - during the first access. If the value returned by lazyPrefix is null, the delegate remains uninitialised, returning a placeholder value and ignoring any assignments, but calling lazyPrefix during each of these operations until it actually returns a value.

See the description of setting() for more info.