xhookLua
Game

ui.Control

Handle to one control; after a reload, get() returns nil and setters do nothing.

Methods

control:get

control:get() -> value

Current value of the control.

Returns Type depends on the builder

control:set

control:set(value [, fire])
NameTypeDescription
valueanySame type get() returns; numbers clamp.
fireoptionalbooleanRun the callback as if the user changed it. Default false.

Sets the value and saves it like a user change.

  • No-op on button, label, separator.
  • A wrong type raises an error.

control:active

control:active() -> boolean

Keybind state: hold = held, toggle = state, always = true.

  • False for unbound keys (except always), other controls, stale handles.
  • Toggle state updates every frame, even with the menu closed.

control:label

control:label() -> string

Current label or caption.

Returns "" for a stale handle

control:set_label

control:set_label(text)
NameTypeDescription
textstringNew label, caption or hint.

Changes the shown text.

Save key and bind id keep the original label.

control:set_visible

control:set_visible(visible)
NameType
visibleboolean

Hides or shows the row; the value is kept.

control:same_line

control:same_line([enabled=true]) -> ui.Control
NameTypeDescription
enabledoptionalbooleanDefault true.

Buttons only: joins the previous button's row.

Returns Same control (chainable).

At most 8 buttons per row.

control:popup

control:popup() -> ui.Popup

Controls in this control's "..." cog, saved under its key.

  • Only checkbox, sliders, combo and multiselect show the cog.
  • Raises an error on a stale handle.
ui.Control ยท Lua API ยท xhook