You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
550 B
26 lines
550 B
#define SOL_ALL_SAFETIES_ON 1
|
|
#include <sol/sol.hpp>
|
|
#include <cassert>
|
|
#include <iostream>
|
|
#include <fmt/core.h>
|
|
#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>("Motion",
|
|
"dx", &Motion::dx,
|
|
"dy", &Motion::dy
|
|
);
|
|
|
|
lua["motion"] = &motion;
|
|
|
|
lua.script("print('dx', motion.dx, 'dy', motion.dy)");
|
|
return 0;
|
|
}
|
|
|