Skip to the content.


LuaBridge 3.0

LuaBridge3 is a lightweight and dependency-free library for mapping data, functions, and classes back and forth between C++ and Lua (a powerful, fast, lightweight, embeddable scripting language). LuaBridge has been tested and works with Lua 5.1.5, 5.2.4, 5.3.6 and 5.4.6 as well as LuaJit 2.x onwards and for the first time also with Luau 0.556 onwards and Ravi 1.0-beta11.

Features

LuaBridge3 is usable from a compliant C++17 compiler and offers the following features:

Improvements Over Vanilla LuaBridge

LuaBridge3 offers a set of improvements compared to vanilla LuaBridge:

Status

Build MacOS Build Windows Build Linux

Code Coverage

Coverage Status

Documentation

Please read the LuaBridge3 Reference Manual for more details on the API.

Release Notes

Plase read the LuaBridge3 Release Notes for more details

Installing LuaBridge3 (vcpkg)

You can download and install LuaBridge3 using the vcpkg dependency manager: ```Powershell or bash git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh # The name of the script should be “./bootstrap-vcpkg.bat” for Powershell ./vcpkg integrate install ./vcpkg install luabridge3


The LuaBridge3 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.

### Update vcpkg

To update the vcpkg port, we need to know the hash of the commit and the sha512 of its downloaded artifact.
Starting from the commit hash that needs to be published, download the archived artifact and get the sha512 of it:

```bash
COMMIT_HASH="0e17140276d215e98764813078f48731125e4784"

wget https://github.com/kunitoki/LuaBridge3/archive/${COMMIT_HASH}.tar.gz

shasum -a 512 ${COMMIT_HASH}.tar.gz
# fbdf09e3bd0d4e55c27afa314ff231537b57653b7c3d96b51eac2a41de0c302ed093500298f341cb168695bae5d3094fb67e019e93620c11c7d6f8c86d3802e2 0e17140276d215e98764813078f48731125e4784.tar.gz

Now update the version in https://github.com/microsoft/vcpkg/blob/master/ports/luabridge3/vcpkg.json and the commit hash and sha512 in https://github.com/microsoft/vcpkg/blob/master/ports/luabridge3/portfile.cmake then commit the changes. Enter into vcpkg folder and issue:

./vcpkg x-add-version --all

Commit the changed files and create a Pull Request for vcpkg.

Unit Tests

Unit test build requires a CMake and C++17 compliant compiler.

There are 11 unit test flavors:

(Luau compiler needs exceptions, so there are no test targets on Luau without exceptions) (Ravi doesn’t fully work without exceptions, so there are no test targets on Ravi without exceptions)

Generate Unix Makefiles and build on Linux:

git clone --recursive git@github.com:kunitoki/LuaBridge3.git

mkdir -p LuaBridge3/build
pushd LuaBridge3/build
cmake -G "Unix Makefiles" ../
cmake --build . -DCMAKE_BUILD_TYPE=Debug
# or cmake --build . -DCMAKE_BUILD_TYPE=Release
# or cmake --build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
popd

Generate XCode project and build on MacOS:

git clone --recursive git@github.com:kunitoki/LuaBridge3.git

mkdir -p LuaBridge3/build
pushd LuaBridge3/build
cmake -G Xcode ../ # Generates XCode project build/LuaBridge.xcodeproj
cmake --build . -DCMAKE_BUILD_TYPE=Debug
# or cmake --build . -DCMAKE_BUILD_TYPE=Release
# or cmake --build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
popd

Generate VS2019 solution on Windows:

git clone --recursive git@github.com:kunitoki/LuaBridge3.git

mkdir LuaBridge3/build
pushd LuaBridge3/build
cmake -G "Visual Studio 16" ../ # Generates MSVS solution build/LuaBridge.sln
popd

Official Repository

LuaBridge3 is published under the terms of the MIT License.

The original version of LuaBridge3 was written by Nathan Reed. The project has been taken over by Vinnie Falco, who added new functionality, wrote the new documentation, and incorporated contributions from Nigel Atkinson. Then it has been forked from the original https://github.com/vinniefalco/LuaBridge into its own LuaBridge3 repository by Lucio Asnaghi, and development continued there.

For questions, comments, or bug reports feel free to open a Github issue or contact Lucio Asnaghi directly at the email address indicated below.

Copyright 2020, Lucio Asnaghi (kunitoki@gmail.com)
Copyright 2019, Dmitry Tarakanov
Copyright 2012, Vinnie Falco (vinnie.falco@gmail.com)
Copyright 2008, Nigel Atkinson
Copyright 2007, Nathan Reed