| 50 | } |
| 51 | |
| 52 | int main() { |
| 53 | std::cout << "=== customization ===" << std::endl; |
| 54 | std::cout << std::boolalpha; |
| 55 | |
| 56 | sol::state lua; |
| 57 | lua.open_libraries(sol::lib::base); |
| 58 | |
| 59 | // Create a pass-through style of function |
| 60 | lua.script( |
| 61 | "function f ( a, b ) print(a, b) return a, b end"); |
| 62 | |
| 63 | // get the function out of Lua |
| 64 | sol::function f = lua["f"]; |
| 65 | |
| 66 | two_things things = f(two_things { 24, false }); |
| 67 | SOL_ASSERT(things.a == 24); |
| 68 | SOL_ASSERT(things.b == false); |
| 69 | // things.a == 24 |
| 70 | // things.b == true |
| 71 | |
| 72 | std::cout << "things.a: " << things.a << std::endl; |
| 73 | std::cout << "things.b: " << things.b << std::endl; |
| 74 | std::cout << std::endl; |
| 75 | |
| 76 | return 0; |
| 77 | } |
nothing calls this directly
no test coverage detected