Skip to main content
Every Add* call returns a handle. That’s how you interact with the control after creating it. Call methods with : syntax (handle:GetValue()). Everything here works on every control. The per-widget pages only document extras.

Properties

id
string?
Full save name when the widget was created with a non-nil key; otherwise nil.

Value

Most controls have one main value (a boolean on Toggle, a number on Slider, …). Use GetValue, SetValue, and OnChange for that. Button and a few others don’t, so use their own callbacks instead.

GetValue

handle:GetValue(): any
Read the control’s current value.

SetValue

handle:SetValue(value: any): ()
Change the control’s value. Single argument only.
value
any
required
Must match the widget’s value type.

OnChange

handle:OnChange(callback: (value: any) -> ()): () -> ()
Run cb(newValue) every time the value changes: user edits, SetValue, SetState.
returns
() -> ()
A function you call to stop listening.
local stop = handle:OnChange(function(v) print(v) end)
stop() -- no longer listening

GetText / SetText

handle:GetText(): string
handle:SetText(text: string): ()
Read or change the control’s label.

Get / Set

handle:Get(field: string): any
handle:Set(field: string, value: any): ()
Read or change other properties on the control (e.g. "formattedValue" on a Slider).

Watch

handle:Watch(field: string, callback: (value: any) -> ()): () -> ()
Listen for changes to a specific property. Returns an unsubscribe function.

Has

handle:Has(field: string): boolean
Check whether the control has a given property.

SetVisible / IsVisible / OnVisibleChange

handle:SetVisible(visible: boolean): ElementHandle
handle:IsVisible(): boolean
handle:OnVisibleChange(callback: (visible: boolean) -> ()): () -> ()
Show or hide the row. SetVisible returns self for chaining.

SetTip

handle:SetTip(tip: string | { title: string?, body: string? }? | nil): ElementHandle
Hover tooltip. Pass nil to remove.
tip
string | table | nil
A string, or { title?, body? } for a two-part tooltip.

OverrideValue

handle:OverrideValue(value: any, priority: number?): OverrideHandle
Force the control’s value without changing what the UI shows. See Overrides.
priority
number
default:"0"
Highest priority wins when multiple scripts override the same control.
returns
OverrideHandle
Released automatically on script unload.

IsOverridden

handle:IsOverridden(): boolean
True while any override is active on this control.

Destroy

handle:Destroy(): ()
Remove the control from the UI.

Exists

handle:Exists(): boolean
true if the control still exists in the menu.

Other methods

If you call a method that isn’t listed here, it’s passed through to the control itself. See the per-widget pages.