| 8 | }; |
| 9 | |
| 10 | int main(int, char*[]) { |
| 11 | |
| 12 | std::cout << "==== runtime_extension =====" << std::endl; |
| 13 | |
| 14 | sol::state lua; |
| 15 | lua.open_libraries(sol::lib::base); |
| 16 | |
| 17 | lua.new_usertype<object>("object"); |
| 18 | |
| 19 | // runtime additions: through the sol API |
| 20 | lua["object"]["func"] = [](object& o) { return o.value; }; |
| 21 | // runtime additions: through a lua script |
| 22 | lua.script( |
| 23 | "function object:print () print(self:func()) end"); |
| 24 | |
| 25 | // see it work |
| 26 | lua.script("local obj = object.new() \n obj:print()"); |
| 27 | |
| 28 | return 0; |
| 29 | } |
nothing calls this directly
no test coverage detected