LuaBridge3 Documentation#

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. It is header-only, works with any Lua version out there (PUC-Lua, LuaJIT, Luau, Ravi), and can be used with or without C++ exceptions enabled.

Note

LuaBridge3 is distributed as a collection of header files. You simply add one line, #include <LuaBridge/LuaBridge.h>, where you want to pass functions, classes, and variables back and forth between C++ and Lua. There are no additional source files, no compilation settings, and no Makefiles.

Documentation areas#

The documentation is organized by topic. Each area contains its own concept guides, walkthroughs, and reference material.

  • Introduction - what LuaBridge3 is, its design goals, repository, and license.

  • Accessing C++ from Lua - registering namespaces, functions, properties, classes, constructors, the Lua stack, and coroutines.

  • Passing Objects - object lifetime models: C++, Lua, and shared lifetime.

  • Accessing Lua from C++ - LuaRef, table proxies, calling Lua functions, and wrapping callables.

  • Security - the metatable security system and how to relax it for trusted scripts.

  • Configuration - compile-time configuration macros.

  • API Reference - the complete registration and reference API.

External resources#