A modern C++ library for binding C and C++ code to Lua, designed to work directly with the Lua C API.
Luacxx is a modern C++ binding library that allows developers to expose C and C++ functions, classes, and data structures to the Lua scripting language. It solves the problem of integrating native code with Lua by providing type-safe conversions and direct interoperability with the Lua C API, enabling seamless two-way communication between C++ and Lua environments.
C++ developers who need to embed Lua scripting in their applications, particularly in domains like game development, tools programming, or embedded systems where Lua is used for configuration or extensibility.
Developers choose Luacxx because it offers a balance of convenience and control—providing modern C++ abstractions for common tasks while preserving direct access to the Lua C API, avoiding the overhead and black-box nature of some higher-level binding libraries.
Lua binding library for modern C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages C++20 features and the standard library for type-safe, idiomatic bindings, as shown in examples using templates and concepts like std::string and std::optional conversions.
Allows seamless mixing of raw Lua C API calls with Luacxx helpers, providing transparency and control without abstraction overhead, per the library's philosophy of working alongside the API.
Offers customizable Push<T>, Store<T>, and Get<T> templates with built-in support for common std types, enabling easy integration of user-defined types via specialization.
Designed for easy consumption in CMake-based projects with exported targets and pkg-config support, simplifying dependency management as demonstrated in the installation and usage instructions.
Requires C++20, which excludes projects using older compilers or standards, limiting adoption in environments with legacy toolchains.
Binding complex classes involves multiple files and metatable definitions, as shown in the counter example, making it more cumbersome than libraries with automated or single-file approaches.
Emphasizes direct access to the Lua C API, necessitating a solid understanding of Lua's stack model, which can be steep for developers new to low-level Lua integration.