ImGuiWindow: InputText Asynchronous
Add a short text field for a name, label, or similar setting. The callback receives the field’s contents when the person leaves the input.
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 | Field label. |
text | string? | Optional starting text; nil starts empty. |
callback | (string) -> () | Function receiving the submitted string. |
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.
Initial and submitted text are limited to 255 bytes. Use another API for multiline documents.
Example
Luau
local window = imgui.create("Example controls")
window:InputText("Preset name", "My preset", function(text)
print("Name:", text)
end)