vinniefalco/LuaBridge
FreeA lightweight, dependency-free library for binding Lua to C++
FreeFree tier
About vinniefalco/LuaBridge
LuaBridge is a lightweight, dependency-free library for mapping data, functions, and classes between C++ and Lua. It is headers-only (just one #include), requires no Makefile or .cpp files, and does not depend on Boost or other external libraries. LuaBridge supports Lua versions 5.1 through 5.4 and LuaJIT, offers type-safe access to the Lua stack, automatic function parameter binding, and different object lifetime management models. The library is MIT licensed and comes with a printable Reference Manual. It is designed for easy integration into C++ projects and is suitable for embedding Lua as a scripting language.
Key Features
Headers-only: single #include, no Makefile, no .cpp files
No dependencies on Boost or other external libraries
MIT licensed
Supports Lua 5.1, 5.2, 5.3, 5.4 and LuaJIT
Type-safe access to the Lua stack
Automatic function parameter type binding
Easy access to Lua objects like tables and functions
Different object lifetime management models
No macros, settings, or configuration scripts needed
Printable Reference Manual available
Pros & Cons
Pros
- Lightweight and minimal: just include the header and start binding
- No external dependencies (no Boost, no extra build steps)
- Works with multiple Lua versions and LuaJIT
- MIT license allows use in commercial and open-source projects
- Clear and easy-to-debug code style
Cons
- Headers-only approach may increase compilation time for large projects
- Requires C++11 or later (C++17 optional for extra features)
- Limited to Lua scripting; does not support other scripting languages
- Documentation primarily via a single manual; may lack extensive examples
Best For
Embedding Lua as a scripting engine in C++ games or applicationsAdding configurable, scriptable behavior to C++ softwareRapid prototyping of C++ logic using Lua scriptsExposing C++ classes and functions to Lua for modding or extension
FAQ
What is LuaBridge?
LuaBridge is a lightweight, dependency-free library for mapping data, functions, and classes between C++ and Lua.
Is LuaBridge free to use?
Yes, LuaBridge is published under the MIT License, allowing free use in both open-source and commercial projects.
What versions of Lua does LuaBridge support?
LuaBridge has been tested with Lua 5.1.5 and should work with any version from 5.1.0 as well as LuaJIT. The unit tests cover Lua 5.1, 5.2, 5.3, and 5.4.
Does LuaBridge have any dependencies?
No. LuaBridge is headers-only and has no dependencies, not even Boost.
How do I build the unit tests?
Unit tests require CMake and a C++11 compliant compiler. Optionally enable C++17 features with -DLUABRIDGE_CXX17=1.