modules
Contains functions to create modules and settings for them
register()
Used to register new modules in the client
register(name: string, display_name: string, description: string, table: luatable): void
Parameters
name | type | description |
---|---|---|
name | string | The name of the module |
display_name | string | The display name of the module, used in arraylist and clickgui |
description | string | The description of the module, shown in the clickgui |
table | luatable | The module table containing all event hooks, you can find all available events here |
Example
local module = {
on_enable = function()
client:print('The module has been enabled!')
end
}
-- Register
modules:register("YourModule", "Your Module", module)
is_enabled()
Returns whether a module is enabled or not
is_enabled(name: string): boolean
Parameters
name | type | description |
---|---|---|
name | string | The name of the module |
set_state()
Sets the enabled state of a module
set_state(name: string, state: boolean): void
Parameters
name | type | description |
---|---|---|
name | string | The name of the module to update the state of |
state | boolean | The new module state |
toggle()
Toggles a module
toggle(name: string): void
Parameters
name | type | description |
---|---|---|
name | string | The name of the module to toggle |
set_setting()
Sets the value of a setting
Some settings have to be treated differently:
- Modes / Enums: Please use the number index of the setting (starts from 0)
Multiple Choice: Please use the number index, you can only toggle ONE at a time, please be aware of that (starts from 0)
set_setting(name: string, setting_id: string, value: object): void
Parameters
name | type | description |
---|---|---|
name | string | The name of the module which contains the setting you want to change |
setting_id | string | The id of the setting you want to change, if you don't know what it is just save a config and take a look at that |
value | object | The new value BEWARE: Observe the formats described in the methods description |
create_boolean_setting()
Used to create a boolean setting for a scripting module
create_boolean_setting(module: string, id: string, name: string, default: boolean): void
Parameters
name | type | description |
---|---|---|
module | string | The module the setting will be added to |
id | string | The id of the setting (used for configs) |
name | string | The name of the setting |
default | boolean | The default value of the setting |
create_integer_setting()
Used to create a integer setting for a scripting module
create_integer_setting(module: string, id: string, name: string, default: int, min: int, max: int, increment: int): void
Parameters
name | type | description |
---|---|---|
module | string | The module the setting will be added to |
id | string | The id of the setting (used for configs) |
name | string | The name of the setting |
default | int | The default value of the setting (ideally in-between of min and max) |
min | int | The minimum value allowed |
max | int | The maximum value allowed |
increment | int | The increment amount |
create_float_setting()
Used to create a float setting for a scripting module
create_float_setting(module: string, id: string, name: string, default: float, min: float, max: float, increment: float): void
Parameters
name | type | description |
---|---|---|
module | string | The module the setting will be added to |
id | string | The id of the setting (used for configs) |
name | string | The name of the setting |
default | float | The default value of the setting (ideally in-between of min and max) |
min | float | The minimum value allowed |
max | float | The maximum value allowed |
increment | float | The increment amount |
create_color_setting()
Used to create a color setting for a scripting module
create_color_setting(module: string, id: string, name: string, default: int): void
Parameters
name | type | description |
---|---|---|
module | string | The module the setting will be added to |
id | string | The id of the setting (used for configs) |
name | string | The name of the setting |
default | int | The default value of the setting |
create_text_setting()
Used to create a text setting for a scripting module
create_text_setting(module: string, id: string, name: string, default: string): void
Parameters
name | type | description |
---|---|---|
module | string | The module the setting will be added to |
id | string | The id of the setting (used for configs) |
name | string | The name of the setting |
default | string | The default value of the setting |
get_setting()
Returns the value of a setting
get_setting(module: string, id: string): object
Parameters
name | type | description |
---|---|---|
module | string | The module which contains the setting |
id | string | The id of the setting |