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.
Luau
ImGuiWindow:InputText(
label: string,
text: string?,
callback: (string) -> ()
) -> 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 | Input label. |
text | string? | Optional initial text. nil gives an empty string. |
callback | (string) -> () | Receives the submitted string when the field loses focus. |
Returns
ImGuiWindowThe 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
Luau
local window = imgui.create("Example controls")
window:InputText("Preset name", "My preset", function(text)
print("Name:", text)
end)