Atomic docs

imgui.Connect

imgui.Connect(callback: function): number

Runs the callback once per frame and returns an id for Disconnect. The callback takes no arguments and runs whether or not the menu is open.

Example

lua
local open = true
local id
id = imgui.Connect(function()
    local visible, still_open = imgui.Begin("my window", open)
    open = still_open
    if visible and imgui.Button("click me") then
        print("clicked")
    end
    imgui.End()          -- always, even when not visible
    if not open then imgui.Disconnect(id) end
end)
↑