Skip to content

button

A basic interactive push-button. It is used to trigger actions when clicked.

local clicked = ui.button(label, size)

The button returns true for a single frame when it is pressed and released. Because CSP scripts run every frame, you typically place this inside an if statement within your update loop.

ParameterTypeRequiredDefaultDescription
labelstringYes-The text displayed on the button.
sizevec2Novec2(0, 0)The dimensions of the button. 0 uses standard padding.
TypeDescription
booleanReturns true during the frame the button is clicked.

A simple button that logs a message when clicked.

if ui.button("Click Me") then
ac.log("Button was pressed!")
end