Lua API
  • 🔎Overview
  • Getting started
    • 🚀Creating scripts
    • 📓Metadata
    • ☎ïļCallbacks
    • 🧠Examples
    • 🌐Useful resources
  • Documentation
    • ⚙ïļNamespaces
      • ðŸ–ĨïļGui
      • ✏ïļRender
      • 🏎ïļEngine
      • ðŸ”ĒMath
      • ⚙ïļUtilities
      • 🙎Entities
      • 📖Database
      • ðŸ–ąïļInput
      • 🌌Panorama
      • ðŸŠķMaterials
      • 📂Filesystem
      • 🗃ïļZip
    • ⚙ïļInstances
      • ⚙ïļGlobal Vars
      • ⚙ïļFatality
      • ⚙ïļGamerules
      • ⚙ïļServer
    • ⚙ïļDatatypes
      • ðŸ–Ĩïļcontrol
      • ðŸ–Ĩïļcheckbox
      • ðŸ–Ĩïļcombobox
      • ðŸ–Ĩïļcolor_picker
      • ðŸ–Ĩïļslider
      • ðŸ–Ĩïļtextbox
      • ðŸ–Ĩïļlist
      • ⚙ïļentity
      • ⚙ïļplayer_info
      • ⚙ïļweapon_info
      • ⚙ïļuser_cmd
      • ⚙ïļtrace_t
      • ⚙ïļvec3
      • ⚙ïļtimer
      • ⚙ïļcvar
      • ⚙ïļshot_info
      • ⚙ïļgame_event
      • ⚙ïļmaterial
      • ⚙ïļmaterial_var
      • ⚙ïļzip
      • ⚙ïļanimator
Powered by GitBook

ÂĐ 2025 - FATALITY

On this page
  • Enums
  • Controls
  • checkbox
  • get_checkbox
  • slider
  • get_slider
  • combobox
  • get_combobox
  • list
  • button
  • label
  • textbox
  • colorpicker
  • get_colorpicker
  • Misc
  • is_menu_open
  • get_menu_rect
  • show_message
  • show_dialog
  • add_notification
  • for_each_hotkey
  1. Documentation
  2. Namespaces

Gui

gui namespace

PreviousNamespacesNextRender

Last updated 1 year ago

If you need to get a container ID or an existing control ID, enable

LUA>GENERAL>Debug mode

and hover on a groupbox or any element.

You can stack most control in line with other controls. To do that, pass the ID of a control that already exists into the container_id argument of the function.

Enums

Hotkey modes
  • hotkey_toggle

  • hotkey_hold

Dialog buttons
  • dialog_buttons_ok_cancel

  • dialog_buttons_yes_no

  • dialog_buttons_yes_no_cancel

Dialog result
  • dialog_result_affirmative

  • dialog_result_negative

Controls

checkbox

local item = gui.checkbox('lua>elements a>test', 'lua>elements a', 'My item')

id

string

new id

container_id

string

container id

label

string

label

Returns:

checkbox

get_checkbox

local item = gui.get_checkbox('lua>elements a>test')

id

string

control id

Returns:

checkbox

slider

local item = gui.slider('lua>elements a>test', 'lua>elements a', 'My item', 0, 100)

id

string

new id

❌

container_id

string

container id

❌

label

string

label

❌

min

number

minimum slider value

❌

max

number

maximum slider value

❌

format

string

format string

'%.0f'

step

number

step value

1.0

Returns:

slider

get_slider

local item = gui.get_slider('lua>elements a>test')

id

string

control id

Returns:

slider

combobox

local item = gui.combobox('lua>elements a>test', 'lua>elements a', true, 'My item', 'Item 1', 'Item 2', 'Item 3')

id

string

new id

container_id

string

container id

label

string

label

is_multi

boolean

true if combobox should enable multiselect

values

string...

items

Returns:

combobox

get_combobox

local item = gui.get_combobox('lua>elements a>test')

id

string

control id

Returns:

combobox

list

local item = gui.list('lua>elements a>test', 'lua>elements a', true, 60)

id

string

new id

❌

container_id

string

container id

❌

label

string

label

❌

is_mult

boolean

true if list should enable multiselect

❌

height

number

element height

120

Returns:

list

button

local item = gui.button('lua>elements a>test', 'lua>elements a', 'My item')

id

string

new id

container_id

string

container id

label

string

label

Returns:

button

label

local item = gui.label('lua>elements a>test', 'lua>elements a', 'My item')

id

string

new id

container_id

string

container id

label

string

label

Returns:

label

textbox

local item = gui.textbox('lua>elements a>test', 'lua>elements a')

id

string

new id

container_id

string

container id

Returns:

textbox

colorpicker

local item = gui.color_picker('lua>elements a>test', 'lua>elements a', 'My item', render.color('#fff'))

id

string

new id

❌

container_id

string

container id

❌

label

string

label

❌

default

default color

❌

allow_alpha

boolean

true if alpha modification is allowed

true

Returns:

list

get_colorpicker

local item = gui.get_colorpicker('lua>elements a>test')

id

string

control id

Returns:

color_picker

Misc

is_menu_open

gui.is_menu_open()

Returns:

menu's visibility state

boolean

get_menu_rect

gui.get_menu_rect()

Returns:

x1

number

y1

number

x2

number

y2

number

show_message

gui.show_message('my_message', 'Hello!', 'Click OK to close this message.')

id

string

messagebox id

title

string

title

message

string

message

show_dialog

gui.show_dialog('my_dialog', 'Hello!', 'Do you like balls?', gui.dialog_buttons_yes_no, function (res)
    if res == gui.dialog_result_affirmative then
        gui.show_message('my_message', 'Hey!', 'Me too');
    else
        gui.show_message('my_message', ':(', 'Ligma');
    end
end);

id

string

dialog id

title

string

title

message

string

message

button

dialog box buttons

callback

result callback

add_notification

gui.add_notification('Hello', 'This lua was loaded!')

title

string

title

message

string

message

for_each_hotkey

gui.for_each_hotkey(function (name, key, mode, is_active)
    print('Hotkey ' .. name .. ':');
    print('\tkey = ' .. tostring(key));
    print('\tmode = ' .. tostring(mode));
    print('\tis_active = ' .. tostring(is_active));
end);

fn

function(string, number, number, bool)

callback function

Callback parameters:

name

string

item name

key

number

mode

hotkey mode

is_active

boolean

true if currently active

function()

active key ()

⚙ïļ
ðŸ–Ĩïļ
Parameter
Datatype
Description
Value
Datatype
checkbox
Parameter
Datatype
Description
Value
Datatype
checkbox
Parameter
Datatype
Description
Default value
Value
Datatype
slider
Parameter
Datatype
Description
Value
Datatype
slider
Parameter
Datatype
Description
Value
Datatype
combobox
Parameter
Datatype
Description
Value
Datatype
combobox
Parameter
Datatype
Description
Default value
Value
Datatype
list
Parameter
Datatype
Description
Value
Datatype
control
Parameter
Datatype
Description
Value
Datatype
control
Parameter
Datatype
Description
Value
Datatype
textbox
Parameter
Datatype
Description
Default value
Value
Datatype
list
Parameter
Datatype
Description
Value
Datatype
color_picker
Value
Datatype
Value
Datatype
Parameter
Datatype
Description
Parameter
Datatype
Description
Parameter
Datatype
Description
Parameter
Datatype
Description
Parameter
Datatype
Description
keycode
Enum
Enum
Enum
render.color