XUtils

LuaBridge

A lightweight library for mapping data, functions, and classes back and forth between C++ and Lua.


Unit Tests

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

To enable C++17 features (std::optional and std::string_view) specify an extra option: -DLUABRIDGE_CXX17=1.

There are the following unit test flavors:

  • Tests51 - uses Lua 5.1.5
  • Tests51Cxx17 - uses Lua 5.1.5 and C++17 features
  • Tests52 - uses Lua 5.2.4,
  • Tests52Cxx17 - uses Lua 5.2.4 and C++17 features
  • Tests53 - uses Lua 5.3.6
  • Tests53Cxx17 - uses Lua 5.3.6 and C++17 features
  • Tests54 - uses Lua 5.4.4
  • Tests54Cxx17 - uses Lua 5.4.4 and C++17 features

Build using Make on Linux/MacOS:

clone --recurse-submodules git@github.com:vinniefalco/LuaBridge.git
cd LuaBridge
cmake -DCMAKE_BUILD_TYPE=Debug -B build
# or cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build
# or cmake -DCMAKE_BUILD_TYPE=Release -B build
cd build
make -j

Generate XCode project on MacOS:

clone --recurse-submodules git@github.com:vinniefalco/LuaBridge.git
cd LuaBridge
cmake -G Xcode -B build
# Generates XCode project build/LuaBridge.xcodeproj

Generate MSVS solution on Windows:

clone --recurse-submodules git@github.com:vinniefalco/LuaBridge.git
cd LuaBridge
mkdir build
cd build
cmake -G "Visual Studio 17 2022 Win64" -B build
# or cmake -G "Visual Studio 15 2017 Win64" -B build
# or cmake -G "Visual Studio 14 2015" -B build
# or cmake -G "Visual Studio 15 2017 Win64" -B build
# or cmake -G "Visual Studio 15 2017" -B build
# or cmake -G "Visual Studio 15 2019" -A Win64 -B build
# or cmake -G "Visual Studio 15 2019" -B build
# Generates MSVS solution build/LuaBridge.sln

Installing LuaBridge (vcpkg)

You can download and install LuaBridge using the vcpkg dependency manager:

 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 luabridge

The LuaBridge 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 on the vcpkg repository.


Articles

  • coming soon...