ConfigManager

Methods
14
Fields
3

Methods

MethodReturnsDescription
getConfig(group: ConfigGroup)anyThe group's proxy (ConfigGroup(name, items) declares the group): config:keyName() reads an item, by its keyName or the getter name gi…
getConfiguration(group: ConfigGroup | string, key: string)string?Four forms: (group, key) is the stored string (or nil); (group, key, type) reads it as type, any type a ConfigItem takes ("int",…
getConfiguration(group: ConfigGroup | string, key: string, type: ConfigItemType)any
getConfiguration(group: ConfigGroup | string, profile: string, key: string, type: ConfigItemType)any
setConfiguration(group: ConfigGroup | string, key: string, value: ConfigValue)()(group, key, value), stored as a string (a Duration as its milliseconds, an Instant as ISO-8601, a WorldPoint as x:y:plane, ...),…
setConfiguration(group: ConfigGroup | string, profile: string, key: string, value: ConfigValue)()
unsetConfiguration(group: ConfigGroup | string, keyOrProfile: string?, key: string?)()(group, key) removes a value, (group, profile, key) an RS profile's.
getConfigurationKeys(prefix: string){string}Whole keys under a prefix.
getRSProfileKey()string?The logged-in account's RS profile.
getRSProfileConfiguration(group: ConfigGroup | string, key: string, type: any?)anyA value of the logged-in account's RS profile.
setRSProfileConfiguration(group: ConfigGroup | string, key: string, value: any)()Write one.
unsetRSProfileConfiguration(group: ConfigGroup | string, key: string)()Remove one.
getRSProfileConfigurationKeys(group: ConfigGroup | string, profile: string?, keyPrefix: string?){string}Keys under a prefix.
getRSProfiles(){RuneScapeProfile}Every RS profile record.
getConfigDescriptor(config: any)ConfigDescriptorThe group's declaration.
sendConfig()()Write every change not yet on disk now.
setDefaultConfiguration(config: any, override: boolean)()Per item: with override, each item with a default written back to it (no ConfigChanged when it is the stored string already) and each wit…

Fields

FieldTypeDescription
RSPROFILE_GROUPstring"rsprofile".
RSPROFILE_DISPLAY_NAMEstring"displayName".
RSPROFILE_TYPEstring"type".

Method details

getConfig

getConfig: (ConfigManager, group: ConfigGroup) -> any

The group's proxy (ConfigGroup(name, items) declares the group): config:keyName() reads an item, by its keyName or the getter name given as method; config:setKeyName(value) (or the item's setter) and config:keyName(value) write it, and nil unsets it. A read is cached until the group changes. The proxy reads and writes the group of the plugin that made it, whoever holds it; another plugin's calls are held to that plugin's rules (see ConfigManager).

getConfiguration

getConfiguration: ((ConfigManager, group: ConfigGroup | string, key: string) -> string?) & ((ConfigManager, group: ConfigGroup | string, key: string, type: ConfigItemType) -> any) & ((ConfigManager, group: ConfigGroup | string, profile: string, key: string, type: ConfigItemType) -> any)

Four forms: (group, key) is the stored string (or nil); (group, key, type) reads it as type, any type a ConfigItem takes ("int", Duration, Color, an enum class, { set = SomeEnum }, ...); (group, profile, key) and (group, profile, key, type) read an RS profile's value. An unset key with a declared default reads as the default.

setConfiguration

setConfiguration: ((ConfigManager, group: ConfigGroup | string, key: string, value: ConfigValue) -> ()) & ((ConfigManager, group: ConfigGroup | string, profile: string, key: string, value: ConfigValue) -> ())

(group, key, value), stored as a string (a Duration as its milliseconds, an Instant as ISO-8601, a WorldPoint as x:y:plane, ...), or (group, profile, key, value) for an RS profile. Writing the value already there changes nothing and posts no ConfigChanged; unsetConfiguration removes one.

setDefaultConfiguration

setDefaultConfiguration: (ConfigManager, config: any, override: boolean) -> ()

Per item: with override, each item with a default written back to it (no ConfigChanged when it is the stored string already) and each without one unset; without, the default written where the stored value is missing or does not read as the item's type.