Files
CPM.cmake/examples/sol2/main.cpp
Lars Melchior 1ebbac6332 Apply clang-format and cmake-format and add style check workflow (#171)
* apply clang-format and cmake-format and add style check workflow

* add declare package definition

* add additional public methods and rename internals

* change development verison tag to 1.0.0

* rename internal method

* rename public method

* rename test var

* update copyright and fix comment

* typo

* run fix-format

* fix test function names
2021-01-06 14:40:33 +01:00

17 lines
340 B
C++

#include <cassert>
#include <sol/sol.hpp>
struct vars {
int boop = 0;
};
int main() {
sol::state lua;
lua.open_libraries(sol::lib::base);
lua.new_usertype<vars>("vars", "boop", &vars::boop);
lua.script(
"beep = vars.new()\n"
"beep.boop = 1\n"
"print('beep boop')");
assert(lua.get<vars>("beep").boop == 1);
}