ImGui

ImGuiWindow.Button

Appends a button to a window. The callback is queued when the user clicks the button.

Syntax

ImGuiWindow.Button(window: ImGuiWindow, label: string, onClick: function): ImGuiWindow

Arguments

NameTypeDescription
windowImGuiWindowWindow returned by imgui.create.
labelstringText displayed on the button.
onClickfunctionCallback invoked without arguments after the button is clicked.

Returns

NameTypeDescription
windowImGuiWindowThe same window handle, allowing chained method calls.

Description

Appends a button to a window. The callback is queued when the user clicks the button.

Call it with 3 parameter(s): window, label, onClick. The argument table explains which values are required and which ones only refine the behavior.

It returns window (ImGuiWindow). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = ImGuiWindow.Button(nil, "example", function() end)
print(result)

Types

ImGuiWindow

Handle returned by imgui.create. Control-building methods return the same handle so calls can be chained.

Button (label: string, onClick: () -> ()) -> ImGuiWindow Appends a button and invokes the callback after a click.Checkbox (label: string, checked: boolean, onChange: (boolean) -> ()) -> ImGuiWindow Appends a checkbox initialized to the provided state.CollapsingHeader (label: string, content: (ImGuiWindow) -> ()) -> ImGuiWindow Groups controls appended by the content callback beneath a collapsing header.ColorPicker (label: string, red: number?, green: number?, blue: number?, alpha: number?, onChange: (number, number, number, number) -> ()) -> ImGuiWindow Appends an RGBA editor; omitted color components default to 1.0.InputText (label: string, text: string?, onChange: (string) -> ()) -> ImGuiWindow Appends a single-line text input; omitted initial text defaults to an empty string.SameLine () -> ImGuiWindow Places the next control on the same line.Separator () -> ImGuiWindow Appends a horizontal separator.SliderFloat (label: string, value: number, minimum: number, maximum: number, onChange: (number) -> ()) -> ImGuiWindow Appends a floating-point slider.SliderInt (label: string, value: integer, minimum: integer, maximum: integer, onChange: (number) -> ()) -> ImGuiWindow Appends an integer slider.Text (text: string) -> ImGuiWindow Appends non-interactive text.destroy () -> () Removes the window and releases its registered callbacks.