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.
Luau
ImGuiWindow:Button(label: string, callback: () -> ()) -> ImGuiWindowParameters
Call this method with a ImGuiWindow receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
| Parameter | Type | Description |
|---|---|---|
label | string | Text shown on the button. |
callback | () -> () | Function called with no arguments when activated. |
Returns
ImGuiWindowThe 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
Luau
local window = imgui.create("Example controls")
window:Button("Show message", function()
print("Button pressed")
end)