> For the complete documentation index, see [llms.txt](https://lua2.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lua2.fatality.win/api/instances/gui.md).

# gui

Usage:

`gui.{func_or_field}`

<table><thead><tr><th width="248">Usage: gui.{func_or_field}</th></tr></thead><tbody><tr><td></td></tr></tbody></table>

This table exposes the GUI system of the software.

{% hint style="info" %}
All types and enums described in the child sections must be prefixed with `gui.`.
{% endhint %}

## ctx﻿ <a href="#ctx" id="ctx"></a>

[<kbd><mark style="background-color:purple;">**Field**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Type: [`Context`](/api/instances/gui/context.md)

GUI context.

***

## notify﻿ <a href="#notify" id="notify"></a>

[<kbd><mark style="background-color:purple;">**Field**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Type: [`NotificationSystem`](/api/instances/gui/notificationsystem.md)

Notification system.

***

## input﻿ <a href="#input" id="input"></a>

[<kbd><mark style="background-color:purple;">**Field**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Type: [`ContextInput`](/api/instances/gui/contextinput.md)

Input context.

***

## MakeControl <a href="#make-control" id="make-control"></a>

[<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2]

Wraps a control into a layout consisting of a label and that specific control. You should add this new control to groupboxes if you want your control to be displayed nicely. Additionally, you can add any extra controls to the returned one - those will get stacked to the left side of your initial control.

**Arguments**

| Name   | Type                                       | Description     |
| ------ | ------------------------------------------ | --------------- |
| `text` | `string`                                   | Label value.    |
| `c`    | [`Control`](/api/instances/gui/control.md) | Control object. |

**Returns**

| Type                                                                | Description    |
| ------------------------------------------------------------------- | -------------- |
| [`Layout`](/api/instances/gui/container/controlcontainer/layout.md) | Layout object. |

**Example**

```lua
local row = gui.MakeControl('Hello checkbox!', my_cb);
```

***

## MakeControlEasy <a href="#make-control" id="make-control"></a>

[<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2]

A quick wrapper for `MakeControl` , returns both the menu element and control.

{% hint style="info" %}
Available types are:

```
checkbox
slider
color_picker
text_input
combo_box
```

{% endhint %}

**Arguments**

| Name    | Type     | Description                 |
| ------- | -------- | --------------------------- |
| `id`    | `string` | ID.                         |
| `label` | `string` | Label value.                |
| `type`  | `string` | The type of this control    |
| `...`   | `any...` | Extra constructor arguments |

**Returns**

| Type                                       | Description                          |
| ------------------------------------------ | ------------------------------------ |
| `any`                                      | Menu element (checkbox, slider etc.) |
| [`Control`](/api/instances/gui/control.md) | Control                              |

**Example**

```lua
local slider, slider_ctrl = gui.MakeControlEasy('my_slider', 'Slider', 'slider', 0, 100);
```

***

## MakeStackedGroups <a href="#make-control" id="make-control"></a>

[<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2]

Creates a vertical stack with two or more [group boxes](/api/instances/gui/container/controlcontainer/group.md).

**Arguments**

| Name     | Type                                                                         | Description         |
| -------- | ---------------------------------------------------------------------------- | ------------------- |
| `id`     | [`ControlID`](/api/instances/gui/types/controlid.md)`\|string`               | ID                  |
| `size`   | [`Vec2`](/api/instances/draw/types/vec2.md)                                  | Size                |
| `groups` | `table<`[`Group`](/api/instances/gui/container/controlcontainer/group.md)`>` | List of group boxes |

**Returns**

| Type                                                                | Description         |
| ------------------------------------------------------------------- | ------------------- |
| [`Layout`](/api/instances/gui/container/controlcontainer/layout.md) | Group stack object. |

**Example**

```lua
local grp1 = gui.Group('grp1', 'My group 1', 150, gui.GroupWidthMode.DEFAULT);
local grp2 = gui.Group('grp2', 'My group 2', 150, gui.GroupWidthMode.DEFAULT);

local stack = gui.MakeStackedGroups("grp12", draw.vec2(234, 400), {
    grp1, grp2
});
```

***

## IsVisible <a href="#make-control" id="make-control"></a>

[<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2]

Returns whether or not the menu is currently open.

**Returns**

| Type      | Description               |
| --------- | ------------------------- |
| `boolean` | If menu is visible or not |

**Example**

```lua
if gui.IsVisible() then
    print('Menu is open!')
end
```

***

## GetActiveOverridePath <a href="#get-pos-abs" id="get-pos-abs"></a>

<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>

Returns the current ragebot/legitbot weapon or category path.

{% hint style="warning" %}
Should only be called when you're alive, causes undefined behavior otherwise.
{% endhint %}

**Arguments**

None.

**Returns**

| Type     | Description                                              |
| -------- | -------------------------------------------------------- |
| `string` | The path currently being used by the ragebot or legitbot |

**Example**

```lua
local override_path = gui.GetActiveOverridePath()
local hitchance = gui.ctx:Find(override_path .. '>weapon>hitchance')
```

***

## GetMainWindow <a href="#get-pos-abs" id="get-pos-abs"></a>

<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>

Returns the menu's main window.

**Arguments**

None.

**Returns**

| Type                                             | Description        |
| ------------------------------------------------ | ------------------ |
| [`Window`](/api/instances/gui/control/window.md) | The window object. |

**Example**

```lua
local wnd = gui.GetMainWindow()
local pos = wnd:GetPosAbs()
```

***

## GetHotkeyList <a href="#get-pos-abs" id="get-pos-abs"></a>

<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>

Returns list of all controls with hotkeys currently added.

**Arguments**

None.

**Returns**

| Type                                                  | Description                              |
| ----------------------------------------------------- | ---------------------------------------- |
| `table<`[`Control`](/api/instances/gui/control.md)`>` | All controls currently with keybinds set |

**Example**

```lua
local controls = gui.GetHotkeyList()
for i, control in ipairs(controls) do
    local element = control:Cast() -- Convert to its parent type
    if element:GetHotkeyState() then
        print('overriding ' .. element:GetLabel().text,
              'value ' .. tostring(element:GetValue():Get()))
    end
end
```

***

## GetThemeColors <a href="#get-pos-abs" id="get-pos-abs"></a>

<kbd><mark style="background-color:purple;">**Function**<mark style="background-color:purple;"></kbd>

Returns list of all colors being used the GUI theme.

{% hint style="info" %}
Available keys are&#x20;

{% code overflow="wrap" fullWidth="false" %}

```
title1, title2, accent, accent2, text, textLight, textMid, textDark, bgBottom, bgBlock, bgBlock2, bgBlockSelectedTab, accentOutline, bgBlockLight, bgOdd, bgEven, outline, outlineLight, warning, danger, success, untrusted
```

{% endcode %}
{% endhint %}

**Arguments**

None.

**Returns**

| Type                                                     | Description     |
| -------------------------------------------------------- | --------------- |
| `table<`[`Color`](/api/instances/draw/types/color.md)`>` | All menu colors |

**Example**

```lua
local colors = gui.GetThemeColors()

draw.surface:AddRect(draw.Rect(0, 0, 100, 100), colors.accent)
```

[^1]: This field is a regular field that must be accessed using a dot (.)

[^2]: This field is a function and must be invoked using a dot (.)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lua2.fatality.win/api/instances/gui.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
