rq.Settings
since 2.35.0
A settings page's values, from rq.config.settings.
Its calls read and write the store the page keeps its values in, under the mod that made the page, so a value the mod reads is the one the page shows.
Fields
| Name | Type | Description |
|---|---|---|
id | string | The page's id. |
Functions
| Name | Summary |
|---|---|
rq.Settings.get | Returns a row's value: the stored one when the row can take it, else the row's default. |
rq.Settings.set | Changes a row's value, as the page would. The page shows it, and on_change callbacks run when it changed. |
rq.Settings.reset | Puts every row back to its default: the keys are taken out of the store. on_change callbacks run for the values that change. |
rq.Settings.get
rq.Settings.get(key) -> boolean|integer|number|stringsince 2.35.0
Returns a row's value: the stored one when the row can take it, else the row's default.
Raises an error for a key no row has.
| Parameter | Type | Description |
|---|---|---|
key | string | The row's key. |
| Returns | Type | Description |
|---|---|---|
value | boolean|integer|number|string | The value. |
rq.Settings.set
rq.Settings.set(key, value)since 2.35.0
Changes a row's value, as the page would. The page shows it, and on_change callbacks run when it changed.
Raises an error for a key no row has, or a value the row cannot take (a stepper's number outside min and max, a choice's value it does not list).
| Parameter | Type | Description |
|---|---|---|
key | string | The row's key. |
value | boolean|integer|number|string | The new value. |
rq.Settings.reset
rq.Settings.reset()since 2.35.0
Puts every row back to its default: the keys are taken out of the store. on_change callbacks run for the values that change.
Events
| Name | Summary |
|---|---|
rq.Settings.on_change | Calls fn when a value changes: on the page, by set or by Reset. |
rq.Settings.on_change
rq.Settings.on_change(fn) -> fun()since 2.35.0
Calls fn when a value changes: on the page, by set or by Reset.
An error in fn is written to the log and the other callbacks still run.
| Parameter | Type | Description |
|---|---|---|
fn | fun(key: string, value: any, old: any) | Gets the row's key, the new value and the one before. |
| Returns | Type | Description |
|---|---|---|
remove | fun() | Removes this callback. |
