ImGuiWindow: Checkbox Asynchronous
Add a checkbox with an initial checked state and a change callback. Use it for an on/off setting. Keep the new callback value in your own settings table if other code needs it.
Luau
ImGuiWindow:Checkbox(
label: string,
checked: any?,
callback: (boolean) -> ()
) -> 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 displayed next to the checkbox. |
checked | any? | Initial state using Luau truthiness: only false and nil are unchecked. |
callback | (boolean) -> () | Receives the new checked state as a boolean. |
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.
Example
Luau
local window = imgui.create("Example controls")
local settings = { showLabels = true }
window:Checkbox("Show labels", settings.showLabels, function(checked)
settings.showLabels = checked
print("Labels enabled:", checked)
end)