Lua API
  • 🔎Overview
  • Introduction
    • 🚀Creating scripts
      • 🧠First Steps
      • 🖥️Adding UI
      • 📚Creating Libraries
  • API
    • 🌐Global Functions
    • ⚙️Instances
      • 🔢Math
      • ☎️Events
        • event_t
      • 🎮Game
        • global_vars_t
        • cengine_client
          • cnet_chan
        • ccsgo_input
        • cinput_system
        • cgame_ui_funcs
        • ccvar
          • convar
      • 🕹️Mods
        • events_t
      • ✏️Draw
        • ⚙️Types
          • ⚙️rect
          • ⚙️vec2
          • ⚙️color
          • ⚙️accessor
        • 🖥️Adapter
        • ✏️Layer
          • outline_mode
          • rounding
          • glow_parts
          • text_params
            • text_alignment
          • shadow_dir
          • command
            • render_mode
        • 🖼️Managed
          • 🖼️texture
            • svg_texture
            • animated_texture
          • 🖼️shader
          • ™️font_base
            • font
            • font_gdi
            • glyph_t
            • font_flags
      • 🙋Entities
        • entity_list_t
          • entity_entry_t
        • base_entity
          • schema_accessor_t
          • cs2_weapon_base_gun
          • cs2_player_pawn
          • cs2_player_controller
          • cs2_weapon_base
          • cs2_grenade_projectile
        • ccsweapon_base_vdata
          • cfiring_mode
        • chandle
        • csweapon_mode
        • csweapon_type
        • weapon_id
        • csweapon_category
        • observer_mode_t
      • 🖥️Gui
        • ⚙️Types
          • ⚙️bits
          • ⚙️control_id
        • context
          • user_t
        • context_input
          • mouse_button
        • notification_system
          • notification
        • control
          • control_type
          • value_param
          • checkbox
          • slider
          • label
          • selectable
          • button
          • color_picker
          • spacer
          • text_input
          • combo_box
          • image
        • container
          • control_container
            • layout
            • group
      • ⚙️Utils
    • ⚙️Types
      • ⚙️ptr
      • ⚙️ref_holder_t
      • ⚙️vector
      • ⚙️vector4d
      • 🎮veccolor
      • 🎮color
      • 🎮cview_setup
      • 🎮cuser_cmd
      • 🎮game_event_t
    • 🟰Enums
      • 🟰client_frame_stage
      • 🟰input_bit_mask
Powered by GitBook

© 2025 - FATALITY

On this page
  • id
  • id_string
  • is_visible
  • parent
  • type
  • inactive
  • inactive_text
  • inactive_color
  • tooltip
  • aliases
  • get_hotkey_state
  • set_visible
  • add_callback
  • cast
  • reset
Export as PDF
  1. API
  2. Instances
  3. Gui

control

This type represents an abstract GUI control.

id

Type: int

Control ID.


id_string

Type: string

String representation of control's ID. This may be empty for some controls.


is_visible

Type: bool

Control's visibility state.


parent

Type: control?

Parent control. Might be nil on some controls.


type

Control's type.


inactive

Type: bool

If set to true, will mark this control to the inactive state.


inactive_text

Type: string

Tooltip replacement to show when control is inactive.


inactive_color

Label color override for inactive controls.


tooltip

Type: string

Tooltip text.


aliases

Type: table[string]

Alias list for this control. Used in search box to support different naming (e.g. if a user searches for "Double tap", will find "Rapid fire" instead).


get_hotkey_state

Returns true if any of the control's hotkeys are active.

Arguments

None.

Returns

Type

Description

bool

true if any hotkey is active.

Example

if ctrl:get_hotkey_state() then
    -- ...
end

set_visible

Changes visibility state for this control.

Calling this method on controls that are located in layouts with large amount of other controls will inevitably cause performance issues due to auto-stacking.

Arguments

Name

Type

Description

val

bool

Visibility state.

Returns

Nothing.

Example

ctrl:set_visible(false);

add_callback

Adds a callback to this control.

Arguments

Name

Type

Description

cbk

function

Callback.

Returns

Nothing.

Example

ctrl:add_callback(function ()
    print('Callback invoked!');
end);

cast

Attempts to downcast the control to the correct type.

Due to Lua engine's limitations, it is impossible to automatically downcast variables. Usually there is no need to call this method, unless you found some control that wasn't somehow already cast to the desired type. find() methods automatically perform the cast to the correct type.

Arguments

None.

Returns

Type

Description

<control>

New type, if any.

Example

local checkbox = maybe_checkbox:cast();

reset

You also should call this method on layouts if you add multiple controls into them.

Arguments

None.

Returns

Nothing.

Example

ctrl:reset();
PreviousnotificationNextcontrol_type

Last updated 3 months ago

Type:

Type:

Resets control's state. This action is usually required if you change control's value directly by interacting with .

⚙️
🖥️
control_type
color
value_param