#define SOL_ALL_SAFETIES_ON 1 #include #include #include #include #include "components.hpp" using namespace fmt; using namespace components; int main(int, char*[]) { std::cout << "=== opening a state ===" << std::endl; sol::state lua; lua.open_libraries(sol::lib::base); auto motion = Motion{1, -1}; lua.new_usertype("Motion", "dx", &Motion::dx, "dy", &Motion::dy ); lua["motion"] = &motion; lua.script("print('dx', motion.dx, 'dy', motion.dy)"); return 0; }