mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
2203c1f64f
Overhaul docs for examples Overhaul function_result and protected_function_result proxies
26 lines
431 B
C++
26 lines
431 B
C++
#define SOL_CHECK_ARGUMENTS 1
|
|
#include <sol.hpp>
|
|
|
|
#include "my_object.hpp"
|
|
|
|
#include <iostream>
|
|
#include <cassert>
|
|
|
|
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"];
|
|
assert(obj.value == 24);
|
|
|
|
return 0;
|
|
} |