Add berry.config
28
berry.config.md
Normal file
28
berry.config.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Read and write to user settings!!! yaya!!!!!
|
||||||
|
|
||||||
|
# Methods
|
||||||
|
## get
|
||||||
|
```lua
|
||||||
|
berry.config.get(section, option)
|
||||||
|
```
|
||||||
|
Get a specific option from the `config.ini` file.
|
||||||
|
#### Parameters:
|
||||||
|
| Name | Type | Description | Default |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `section` | `string` | The section name. You can look at the `config.ini` file in your `.berry` folder to see what sections can be read from. | *required* |
|
||||||
|
| `option` | `string` | The option name. You can look at the `config.ini` file in your `.berry` folder to see what options can be read from. | *required* |
|
||||||
|
|
||||||
|
## defineSetting
|
||||||
|
```lua
|
||||||
|
berry.config.defineSetting(sectionName, optionName, description, optionType, defaultValue, onChanged?)
|
||||||
|
```
|
||||||
|
Change a setting.
|
||||||
|
#### Parameters:
|
||||||
|
| Name | Type | Description | Default |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `sectionName` | `string` | The section name that appears in the **Plugins** tab of the settings menu. | *required* |
|
||||||
|
| `optionName` | `string` | The name of the option. | *required* |
|
||||||
|
| `description` | `string` | A description that appears below the name of the option. | *required* |
|
||||||
|
| `optionType` | `string` | The type of the option. Possible types: `string`, `integer`, `float`, `boolean` | *required* |
|
||||||
|
| `defaultValue` | `string` | The default value. This MUST be a string, if you want to define a boolean set the default value to either `"1"` or `"0"`. | *required* |
|
||||||
|
| `onChanged` | `function` | A function that gets called whenever the setting is changed. The function is passed the new value of the setting. | `nil` |
|
||||||
Reference in New Issue
Block a user