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

nametypedescription
namestringThe name of the module
display_namestringThe display name of the module, used in arraylist and clickgui
descriptionstringThe description of the module, shown in the clickgui
tableluatableThe 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

nametypedescription
namestringThe name of the module

set_state()

Sets the enabled state of a module

set_state(name: string, state: boolean): void

Parameters

nametypedescription
namestringThe name of the module to update the state of
statebooleanThe new module state

toggle()

Toggles a module

toggle(name: string): void

Parameters

nametypedescription
namestringThe 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

nametypedescription
namestringThe name of the module which contains the setting you want to change
setting_idstringThe 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
valueobjectThe 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

nametypedescription
modulestringThe module the setting will be added to
idstringThe id of the setting (used for configs)
namestringThe name of the setting
defaultbooleanThe 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

nametypedescription
modulestringThe module the setting will be added to
idstringThe id of the setting (used for configs)
namestringThe name of the setting
defaultintThe default value of the setting (ideally in-between of min and max)
minintThe minimum value allowed
maxintThe maximum value allowed
incrementintThe 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

nametypedescription
modulestringThe module the setting will be added to
idstringThe id of the setting (used for configs)
namestringThe name of the setting
defaultfloatThe default value of the setting (ideally in-between of min and max)
minfloatThe minimum value allowed
maxfloatThe maximum value allowed
incrementfloatThe 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

nametypedescription
modulestringThe module the setting will be added to
idstringThe id of the setting (used for configs)
namestringThe name of the setting
defaultintThe 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

nametypedescription
modulestringThe module the setting will be added to
idstringThe id of the setting (used for configs)
namestringThe name of the setting
defaultstringThe default value of the setting

get_setting()

Returns the value of a setting

get_setting(module: string, id: string): object

Parameters

nametypedescription
modulestringThe module which contains the setting
idstringThe id of the setting