$ show sonoro1234/LuaJIT-ImGui
This repository provides LuaJIT FFI bindings for Dear ImGui (and ImPlot, ImGuizmo, ImNodes, etc.) via the cimgui C wrapper. It includes a high-level Lua module (`imgui`) that adds convenience functions, backends for GLFW, SDL2, SDL3, and LΓVE2D, as well as numerous example applications (code editor, node editors, file browser, plotter, etc.). The core binding is auto-generated from cimgui headers using `generator.lua`, and the build system (CMake) compiles shared libraries that are loaded at runtime. The repository serves as both a binding library and a showcase of Dear ImGui capabilities in Luaβit is not a data research project. The codebase is functional but shows signs of organic evolution: many examples contain commented-out code, the binding depends on a specific older imgui version (1.92.9b docking), and there are no formal tests. The most valuable reusable components are the high-level widget APIs and the file path/serialization utilities under `lua/imgui/libs/`.
The LLM identified 5 files worth highlighting for reuse:
A self-contained modal file browser widget built on Dear ImGui. It provides directory navigation, file filtering by pattern, and returns the selected file path. Depends only on `imgui.libs.path` and the base ImGui API, so it can be extracted into another LuaJIT-ImGui project with minimal changes. Demonstrates careful state management for a modal dialog.
A Lua table serializer that converts tables to executable Lua code strings. Handles nested tables, circular references (via `__serialize` callback), and basic data types. The companion `serializer_c.lua` extends it for FFI cdata support. This is a standalone utility useful for persistence and data exchange.
A pure-Lua file path manipulation library that normalizes, joins, and resolves relative/absolute paths. Abstracts over LuaFileSystem with a fallback to a pure-Lua implementation. This is a general-purpose utility that can be reused in any Lua project without external dependencies.
The core high-level wrapper that extends the auto-generated FFI binding with ergonomic Lua APIs. Includes `LuaCombo` (dynamic combo box with callbacks), `LuaCurve` (Bezier curve editor), `Plotter` (function plot), `Log`/`CLog` (console windows), `dial`, `pad`, and 2D transformation helpers. These are immediate-mode widgets that are cleanly decoupled from the backend and can be reused in any LuaJIT-ImGui application.
A Lua script that parses cimgui C definitions (from `definitions.lua`) and generates the Lua FFI binding files (`cdefs.lua`, `base.lua`, etc.). It resolves overloaded functions via type-dispatch decision trees, sanitizes reserved words, and validates with `loadstring`. This pattern of auto-generating FFI bindings from C headers is reusable for wrapping other C libraries with LuaJIT.