Lua · Variables · Script UI
menu
Build the script's own page: text, buttons, inputs, lists and images.
Define function on_menu() and call menu.* inside it. It runs every frame while the script's tab is open. Widgets are immediate-mode: pass the current value in, get the new value back, and keep it in your own variable.
Outside on_menu the widgets do nothing and return the value you passed in (buttons return false). Keep the widgets in the same order every frame; the order is how each widget is told apart.
Every click and change is logged to the console as menu: <label> = <value>.
| Function | What it does |
|---|---|
menu.text(text) | A line of text. |
menu.section(title) | A section heading. |
menu.separator() | A thin line. |
menu.spacing() | Some empty space. |
menu.same_line() | Puts the next widget to the right of the last button. Works only right after a button. |
menu.button(label) | A button. |
menu.checkbox(label, value) | A checkbox. |
menu.slider(label, value, min, max[, decimals]) | A slider. |
menu.combo(label, index, items) | A dropdown. |
menu.color(label, col) | A colour picker. |
menu.keybind(label, vk) | A key picker. |
menu.input(label, text) | A one-line text field, up to 255 bytes. |
menu.tooltip(text) | A hover tooltip on the widget drawn just before it. |
menu.progress(label, value) | A progress bar. |
menu.list(label, selected, items[, rows]) | A scrolling list. |
menu.image(handle, w, h) | An image from draw.load_image. The width is capped to the page width. |