#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;
}
