LuaBind is a C++ library for binding Lua and C++, designed for performance and easy integration into game engines.
- Based on Lua 5.5
- Cross platform
- C++ API to access and manipulate Lua types (primitives, tables)
- Binding of C++ classes and C-style opaque types
- Support for inheritance
- Support for std containers, pairs, tuples, optional, expected, unique_ptr
- Support for lightweight types (e.g. math classes)
- Support for Lua scripts
- No exceptions
- No RTTI
- Unit tested
- C++ 20
- Clone the repository to a local folder
git clone https://github.com/StefanoLanza/LuaBind.git - The library uses Premake to generate projects for Windows or Linux
InstallPremake 5.0.0-beta8or latest - On Windows
- Run
premake5.exe vs20xx --with-tests --with-examples(replacevs20xxwith your version of Visual Studio, e.g.vs2022)
This command generates a Visual Studio solution - Open
build/vs2022/LuaBind.sln - Select a build configuration
- Build and run the examples and the UnitTest project
- Run
- On Linux
- Run
./premake gmake -cc=gcc --with-tests --with-examples
This command generate GNU makefiles - Build and run the examples and the UnitTest application
make -C build/gmake config=configuration(configuration is for examplerelease_x86)
- Run
- For integration in your own project
- Add the folders
include, src, external/core, external/lua, external/coreto your project build configuration - Add
includeandexternalto your project include paths
Please see the file premake5.lua as a reference. * We will support industry-standard CMake in a future patch to facilitate this process - Add the folders
Look at the file include/config.h Here you can find configuration settings for the library. You can change these settings by either editing this file or by defining them with the preprocessor in your build configuration.
Look inside the examples folder for sample code.
- CMake support
- Support for default function arguments
- Support for MacOS, iOS, Android, HarmonyOS
- Support for C++ 17 on request
- Documentation
- Conan package