Skip to content

types.feature

A registered feature

Functions

on(name : string, handler : function)

Registers an event handler

  • name (string) The name of the event to listen to
  • handler (function) The event handler function
  • A list of supported events can be found in Events

is_enabled(): boolean

Returns whether the feature is enabled or not

  • returns (boolean) The enabled state

toggle(state : boolean): boolean

Toggles the feature on or off

  • state (boolean) The enabled state

register_boolean(name : string, value : boolean, opt_visibility : function): types.boolean_property

Registers a boolean property

  • name (string) The name of the boolean property
  • value (boolean) The default boolean value
  • opt_visibility (function) The optional setting gui visibility
  • returns (types.boolean_property) The registered boolean property
lua
local property = feature.register_boolean("Hello Test", false, function() return true end)  
local property = feature.register_boolean("Hello Test", false)

register_string(name : string, value : string, opt_visibility : function): types.string_property

Registers a string property

  • name (string) The name of the string property
  • value (string) The default string value
  • opt_visibility (function) The optional setting gui visibility
  • returns (types.string_property) The registered string property
lua
local property = feature.register_string("Hello Test", "Hello World", function() return true end)  
local property = feature.register_string("Hello Test", "Hello World")

register_number(name : number, value : number, opt_visibility : function): types.number_property

Registers a number property

  • name (string) The name of the number property
  • min (number) The minimum number value
  • max (number) The maximum number value
  • step (number) The step number value
  • value (number) The default number value
  • opt_visibility (function) The optional setting gui visibility
  • returns (types.number_property) The registered number property
lua
local property = feature.register_number("Hello Test", 0, 10, 1, 5, function() return true end)  
local property = feature.register_number("Hello Test", 0, 10, 0.1, 5)

register_color(name : string, value : types.color, opt_visibility : function): types.color_property

Registers a color property

  • name (string) The name of the color property
  • value (types.color) The default types.color value
  • opt_visibility (function) The optional setting gui visibility
  • returns (types.color_property) The registered color property
lua
local property = feature.register_color("Hello Test", types.color.white, function() return true end)  
local property = feature.register_color("Hello Test", types.color.new(255, 0, 255))

register_enum(name : string, options : table, value : string, opt_visibility : function): types.enum_property

Registers an enum property

  • name (string) The name of the enum property
  • options (table) The list of available options
  • value (string) The default enum value
  • opt_visibility (function) The optional setting gui visibility
  • returns (types.enum_property) The registered enum property
lua
local property = feature.register_enum("Hello Test", {"Option 1", "Option 2"}, "Option 1", function() return true end)  
local property = feature.register_enum("Hello Test", {"Option 1", "Option 2"}, "Option 1")

register_multi_select(name : string, options : table, values : table, opt_visibility : function): types.multi_select_property

Registers a multi select property

  • name (string) The name of the multi select property
  • options (table) The list of available options
  • values (table) The default multi select values
  • opt_visibility (function) The optional setting gui visibility
  • returns (types.multi_select_property) The registered multi select property
lua
local property = feature.register_multi_select("Hello Test", {"Option 1", "Option 2"}, {"Option 1"}, function() return true end)  
local property = feature.register_multi_select("Hello Test", {"Option 1", "Option 2"}, {"Option 1"})