MCPcopy Create free account
hub / github.com/ThePhD/sol2 / main

Function main

examples/source/exception_handler.cpp:41–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41int main() {
42 std::cout << "=== exception_handler ===" << std::endl;
43
44 sol::state lua;
45 lua.open_libraries(sol::lib::base);
46 lua.set_exception_handler(&my_exception_handler);
47
48 lua.set_function("will_throw", &will_throw);
49
50 sol::protected_function_result pfr = lua.safe_script(
51 "will_throw()", &sol::script_pass_on_error);
52
53 SOL_ASSERT(!pfr.valid());
54
55 sol::error err = pfr;
56 std::cout << err.what() << std::endl;
57
58 std::cout << std::endl;
59
60 return 0;
61}

Callers

nothing calls this directly

Calls 5

open_librariesMethod · 0.80
set_exception_handlerMethod · 0.80
safe_scriptMethod · 0.80
whatMethod · 0.80
validMethod · 0.45

Tested by

no test coverage detected