đŸ–Ĩī¸Gui

gui namespace

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:

get_checkbox

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

Returns:

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:

get_slider

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

Returns:

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:

get_combobox

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

Returns:

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:

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:

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:

textbox

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

id

string

new id

container_id

string

container id

Returns:

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:

get_colorpicker

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

Returns:

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

function(Enum)

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

active key (keycode)

mode

hotkey mode

is_active

boolean

true if currently active

Last updated