sol2/examples/require_dll_example/require_from_dll.cpp
ThePhD 002303d52b update tests and single again
add assert.hpp for better code understanding
prepare to rewrite all the damn docs, and update the tutorials...
2017-12-25 23:27:22 -05:00

26 lines
436 B
C++

#define SOL_CHECK_ARGUMENTS 1
#include <sol.hpp>
#include "my_object.hpp"
#include "assert.hpp"
#include <iostream>
int main(int, char*[]) {
std::cout << "=== require from DLL example ===" << std::endl;
sol::state lua;
lua.open_libraries(sol::lib::package);
lua.script_file(R"(
mo = require("my_object")
obj = mo.test.new(24)
print(obj.value)
)");
my_object::test& obj = lua["obj"];
c_assert(obj.value == 24);
return 0;
}