slider
A widget that allows users to select a value from a specified range by dragging a handle.
Signature
Section titled “Signature”-- standard usagelocal newValue, changed = ui.slider(label, value, min, max, format)
-- using a refnumberlocal changed = ui.slider(label, myRefNumber, min, max, format)Description
Section titled “Description”Sliders are ideal for adjusting settings like opacity, volume, or sensitivity.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | Yes | - | Identifier label. Use ## to hide the text. |
value | number or refnumber | Yes | - | The current value. |
min | number | No | 0.0 | Minimum possible value. |
max | number | No | 1.0 | Maximum possible value. |
format | string | No | "%.3f" | C-style format string for the display value. |
Return Values
Section titled “Return Values”| Type | Description |
|---|---|
boolean | Returns true while the slider is being moved. |
number | (Only if passing standard number) The updated value. |
Examples
Section titled “Examples”Adjusting a simple float value.
local opacity = refnumber(1.0)
if ui.slider("Opacity", opacity, 0, 1) then -- Opacity is being changedendDisplaying the value as a whole number.
local count = refnumber(5)
-- use "%.0f" to hide decimals in the slider textui.slider("Item Count", count, 0, 10, "Count: %.0f")