sol2

[full]

`sol2` is a C++ library binding to Lua.

Documentation Status

sol2 is a C++ library binding to Lua. It currently supports all Lua versions 5.1+ (LuaJIT 2.0+ and MoonJIT included). sol2 aims to be easy to use and easy to add to a project. The library is header-only for easy integration with projects, and a single header can be used for drag-and-drop start up.

Sneak Peek

#include <sol/sol.hpp>
#include <cassert>

int main() {
    sol::state lua;
    int x = 0;
    lua.set_function("beep", [&x]{ ++x; });
    lua.script("beep()");
    assert(x == 1);
}
#include <sol/sol.hpp>
#include <cassert>

struct vars {
    int boop = 0;
};

int main() {
    sol::state lua;
    lua.new_usertype<vars>("vars", "boop", &vars::boop);
    lua.script("beep = vars.new()\n"
               "beep.boop = 1");
    assert(lua.get<vars>("beep").boop == 1);
}
... More
license MIT
project sol2
url github.com/ThePhD/sol2
5 Versions
version 3.3.1
repository https://pkg.cppget.org/1/stable
depends 1; lua
version 3.2.3
repository https://pkg.cppget.org/1/stable
depends 1; lua
version 3.2.2
repository https://pkg.cppget.org/1/stable
depends 1; lua
version 3.2.1
repository https://pkg.cppget.org/1/stable
depends 1; lua
version 3.2.0+2
repository https://pkg.cppget.org/1/stable
depends 1; lua