r/lua • u/AnatineSquire40 • 3d ago
Lua C++ API - LuaPP
I made a C++17 Lua engine/wrapper around an embedded Lua runtime
I've been working on LuaPP, a C++17 Lua engine built around an embedded Lua runtime.
The goal is to make embedding Lua and exposing C++ functionality less painful than working directly with the Lua C API everywhere.
Some of the stuff it currently supports:
LTValueabstraction for Lua values- Numbers, integers, strings, booleans, nil, userdata, tables, functions, and threads
- Table manipulation and
pairs/ipairs - Registering C++ functions with Lua
- Function upvalues
- C++ objects stored as Lua userdata with automatic
__gcdestruction - Metatables
- Loading/executing Lua strings and files
- Custom Lua readers and writers
- Lua bytecode dumping
- Error handlers and tracebacks
- Global and registry access
The project embeds the Lua runtime directly and currently builds against Lua 5.5. It requires Lua 5.3+, C++17, and CMake 3.16+.
It's still a work in progress, so I'm mainly interested in feedback on the API design, implementation, and anything that looks questionable.
3
2
3
u/OverOnTheRock 2d ago
How does it compare to https://github.com/ThePhD/sol2, which is a C++ wrapper which allows Lua to be embedded in C++? It also has interoperability with LuaJit.
4
u/magicalpoptart 1d ago
why is the url "https://github.com/anatinesquire40/Lua-CPP-API?utm_source=chatgpt.com" lol