ImGuiWindow:Checkbox Asynchronous

Add an on/off control with an initial state. Keep the boolean passed to the callback if the rest of your script needs the updated setting.

Syntax
Luau
ImGuiWindow:Checkbox(
    label: string,
    checked: any?,
    callback: (boolean) -> ()
) -> 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
labelstringText displayed beside the checkbox.
checkedany?Initial state; false and nil are unchecked, while other values are checked.
callback(boolean) -> ()Function receiving the new checked state as a boolean.

Returns

ImGuiWindow

The 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.

Example

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)
Kawaii documentation