Menu

fatality.menu

Functions

get_reference

returns a config value for a menu control element

menu:get_reference( tab_name, subtab_name, group_name, control_name )

Parameter

Data type

Description

tab_name

string

control tab name. ex "visuals"

subtab_name

string

control subtab name. ex "esp"

group_name

string

control group name. ex "player"

control_name

string

control name. ex "box"

Controls

Checkbox

creates a checkbox

menu:add_checkbox( control_name, tab_name, subtab_name, group_name, config_item )

Parameter

Data type

Description

control_name

string

name of your control

tab_name

string

tab to be placed in

subtab_name

string

subtab to be placed in

group_name

string

group to be placed in

config_item

config item for element

Slider

creates a slider

menu:add_slider( control_name, tab_name, subtab_name, group_name, config_item, min, max, step )

Parameter

Data type

Description

control_name

string

name of your control

tab_name

string

tab to be placed in

subtab_name

string

subtab to be placed in

group_name

string

group to be placed in

config_item

config item for element

min

float

minimum slider value

max

float

maximum slider value

step

float

value increment

Combo

creates a combo box

menu:add_combo( control_name, tab_name, subtab_name, group_name, config_item)

Parameter

Data type

Description

control_name

string

name of your control

tab_name

string

tab to be placed in

subtab_name

string

subtab to be placed in

group_name

string

group to be placed in

config_item

config item for element

adds an item to combo

combo:add_item( item_name, config_value )

Parameter

Data type

Description

item_name

string

name of item in combo

config_value

config item for new item

Multi-combo

creates a combo box

menu:add_multi_combo( control_name, tab_name, subtab_name, group_name, config_item)

Parameter

Data type

Description

control_name

string

name of your control

tab_name

string

tab to be placed in

subtab_name

string

subtab to be placed in

group_name

string

group to be placed in

config_item

config item for element

adds an item to combo

multi_combo:add_item( item_name, config_value )

Parameter

Data type

Description

item_name

string

name of item in combo

config_value

config item for new item

Button

adds a button

menu:add_button(control_name, tab_name, subtab_name, group_name, function)

Parameter

Data type

Description

control_name

string

name of your control

tab_name

string

tab to be placed in

subtab_name

string

subtab to be placed in

group_name

string

group to be placed in

function

function

function to be called when

the button is pressed

Examples

How to create and use controls

-- Get config and menu table
local Config    = fatality.config
local Menu      = fatality.menu

-- Create a config item named "Example Checkbox item" with an inital value of 0 or false
local CheckboxConfigItem = Config:add_item( "Example Checkbox item", 0 )

-- Add a checkbox in Visuals->Misc->Local using our config item
local ExampleCheckbox = Menu:add_checkbox( "Example Checkbox", "Visuals", "Misc", "Local", CheckboxConfigItem )

-- Print the state of our checkbox by using get_bool
print(CheckboxConfigItem:get_bool() and "Checkbox on" or "Checkbox off")

-- Create a config item named "Example Combo Item" with an inital value of 0. 
-- The inital value of a combo config item does not matter
local ComboConfigItem = Config:add_item( "Example Combo Item", 0 )
-- Create a config item for our combo item to use with an inital item of 1 or true
local ComboConfigItemOne = Config:add_item( "Example Combo Item Value", 1)

-- Add a combo in Visuals->Misc->Local using our config item
local ExampleCombo = Menu:add_combo( "Example Combo", "Visuals", "Misc", "Local", ComboConfigItem )

-- Add items to our combo by using combo:add_item
ExampleCombo:add_item( "Example Item One", ComboConfigItemOne)

-- Print the state of our item by using get_bool
print(ComboConfigItemOne:get_bool() and "Combo item active" or "Combo item inactive")

Last updated