parent
f46b5f15ef
commit
9c03e850b5
@ -1,17 +1,26 @@ |
||||
#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; |
||||
// open some common libraries
|
||||
lua.open_libraries(sol::lib::base, sol::lib::package); |
||||
lua.script("print('bark bark bark!')"); |
||||
lua.open_libraries(sol::lib::base); |
||||
auto motion = Motion{1, -1}; |
||||
lua.new_usertype<Motion>("Motion", |
||||
"dx", &Motion::dx, |
||||
"dy", &Motion::dy |
||||
); |
||||
|
||||
std::cout << std::endl; |
||||
lua["motion"] = &motion; |
||||
|
||||
lua.script("print('dx', motion.dx, 'dy', motion.dy)"); |
||||
return 0; |
||||
} |
||||
|
Loading…
Reference in new issue