Skip to content

kunitoki/LuaBridge3

Repository files navigation


LuaBridge 3.0

LuaBridge 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 revisions starting from 5.1.5, and also compatibility is provided with lua 5.2.4, 5.3.6 and 5.4.3 as well as LuaJit and Luau.

Features

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

  • MIT Licensed
  • Headers-only: No Makefile, no .cpp files, just one #include and one header file (optional) !
  • Simple, light, and nothing else needed.
  • No macros, settings, or configuration scripts needed.
  • Supports different object lifetime management models.
  • Convenient, type-safe access to the Lua stack.
  • Automatic function parameter type binding.
  • Easy access to Lua objects like tables and functions.
  • Interoperable with most common c++ standard library container types.
  • Can work with both c++ exceptions and without (Works with -fno-exceptions and /EHsc-).
  • Written in a clear and easy to debug style.

Status

Build MacOS Build Windows Build Linux

Code Coverage

Coverage Status

Documentation

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

Release Notes

Plase read the LuaBridge Release Notes for more details

Unit Tests

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

There are 9 unit test flavors:

  • LuaBridgeTests51 - uses Lua 5.1
  • LuaBridgeTests51Noexcept - uses Lua 5.1 without exceptions enabled
  • LuaBridgeTests52 - uses Lua 5.2
  • LuaBridgeTests52Noexcept - uses Lua 5.2 without exceptions enabled
  • LuaBridgeTests53 - uses Lua 5.3
  • LuaBridgeTests53Noexcept - uses Lua 5.3 without exceptions enabled
  • LuaBridgeTests54 - uses Lua 5.4
  • LuaBridgeTests54Noexcept - uses Lua 5.4 without exceptions enabled
  • LuaBridgeTestsLuau - uses Luau

(Luau compiler needs exceptions, so there is no tests that runs on Luau without exceptions)

Generate Unix Makefiles and build on Linux:

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

mkdir -p LuaBridge/build
pushd LuaBridge/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 LuaBridge/build
pushd LuaBridge/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 LuaBridge/build
pushd LuaBridge/build
cmake -G "Visual Studio 16" ../ # Generates MSVS solution build/LuaBridge.sln
popd

Official Repository

LuaBridge is published under the terms of the MIT License.

The original version of LuaBridge 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