ImGuiWindow:InputText Asynchronous

Add a text input and receive submitted text in a callback. Use it for a name, label, or other short text setting. The callback receives the submitted contents rather than a control handle.

Syntax
Luau
ImGuiWindow:InputText(
    label: string,
    text: string?,
    callback: (string) -> ()
) -> 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
labelstringInput label.
textstring?Optional initial text. nil gives an empty string.
callback(string) -> ()Receives the submitted string when the field loses focus.

Returns

ImGuiWindow

The same ImGuiWindow, allowing another window method to be chained.

Usage notes

Interaction callbacks run when the control is used. Their return values are discarded.

Initial and submitted text are limited to 255 bytes. This is intended for short input rather than multiline document editing.

Example

Example
Luau
local window = imgui.create("Example controls")
window:InputText("Preset name", "My preset", function(text)
    print("Name:", text)
end)
Kawaii documentation