ImGuiWindow:Button Asynchronous

Add an action button to a window. The callback runs when the person activates the button, so put the action inside that function rather than after this call.

Syntax
Luau
ImGuiWindow:Button(label: string, callback: () -> ()) -> ImGuiWindow

Parameters

Call this method with a ImGuiWindow receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
labelstringText shown on the button.
callback() -> ()Function called with no arguments when activated.

Returns

ImGuiWindow

The same ImGuiWindow handle, so more controls can be added with another method call.

Usage notes

The callback runs when the user interacts with the control. Its return value is ignored.

Example

Example
Luau
local window = imgui.create("Example controls")
window:Button("Show message", function()
    print("Button pressed")
end)
Kawaii documentation