ui.Control
Handle to one control; after a reload, get() returns nil and setters do nothing.
Methods
control:get
control:get() -> valueCurrent value of the control.
Returns Type depends on the builder
control:set
control:set(value [, fire])| Name | Type | Description |
|---|---|---|
| value | any | Same type get() returns; numbers clamp. |
| fireoptional | boolean | Run 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() -> booleanKeybind 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() -> stringCurrent label or caption.
Returns "" for a stale handle
control:set_label
control:set_label(text)| Name | Type | Description |
|---|---|---|
| text | string | New label, caption or hint. |
Changes the shown text.
Save key and bind id keep the original label.
control:set_visible
control:set_visible(visible)| Name | Type |
|---|---|
| visible | boolean |
Hides or shows the row; the value is kept.
control:same_line
control:same_line([enabled=true]) -> ui.Control| Name | Type | Description |
|---|---|---|
| enabledoptional | boolean | Default true. |
Buttons only: joins the previous button's row.
Returns Same control (chainable).
At most 8 buttons per row.
control:popup
control:popup() -> ui.PopupControls 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.