| 119 | } |
| 120 | |
| 121 | int main() |
| 122 | { |
| 123 | std::shared_ptr<lua_State> L=init_lua_state(); |
| 124 | |
| 125 | for( int i=0; i!=10; ++i ) |
| 126 | { |
| 127 | leaf::try_handle_all( |
| 128 | |
| 129 | [&]() -> leaf::result<void> |
| 130 | { |
| 131 | BOOST_LEAF_AUTO(answer, call_lua(&*L)); |
| 132 | std::cout << "do_work succeeded, answer=" << answer << '\n'; |
| 133 | return { }; |
| 134 | }, |
| 135 | |
| 136 | []( do_work_error_code e, e_lua_error_message const & msg ) |
| 137 | { |
| 138 | std::cout << "Got do_work_error_code = " << e << ", " << msg.value << "\n"; |
| 139 | }, |
| 140 | |
| 141 | []( e_lua_pcall_error const & err, e_lua_error_message const & msg ) |
| 142 | { |
| 143 | std::cout << "Got e_lua_pcall_error, " << err << ", " << msg.value << "\n"; |
| 144 | }, |
| 145 | |
| 146 | []( leaf::error_info const & unmatched ) |
| 147 | { |
| 148 | std::cerr << |
| 149 | "Unknown failure detected" << std::endl << |
| 150 | "Cryptic diagnostic information follows" << std::endl << |
| 151 | unmatched; |
| 152 | } ); |
| 153 | } |
| 154 | |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | #ifdef BOOST_LEAF_NO_EXCEPTIONS |
| 159 |
nothing calls this directly
no test coverage detected