sol2/examples/docs/simple_functions.cpp
ThePhD 22c41d9482 Update documentation, refactor examples out of docs, fix warning about static entry path
Still need help refactoring out more code from docs...
2018-02-24 17:19:16 -05:00

19 lines
269 B
C++

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