| 146 | } |
| 147 | |
| 148 | int main() |
| 149 | { |
| 150 | std::shared_ptr<lua_State> L=init_lua_state(); |
| 151 | |
| 152 | for( int i=0; i!=10; ++i ) |
| 153 | { |
| 154 | leaf::try_catch( |
| 155 | |
| 156 | [&] |
| 157 | { |
| 158 | int answer = call_lua(&*L); |
| 159 | std::cout << "do_work succeeded, answer=" << answer << '\n'; |
| 160 | |
| 161 | }, |
| 162 | |
| 163 | []( do_work_error_code e, e_lua_error_message const & msg ) |
| 164 | { |
| 165 | std::cout << "Got do_work_error_code = " << e << ", " << msg.value << "\n"; |
| 166 | }, |
| 167 | |
| 168 | []( e_lua_pcall_error const & err, e_lua_error_message const & msg ) |
| 169 | { |
| 170 | std::cout << "Got e_lua_pcall_error, " << err << ", " << msg.value << "\n"; |
| 171 | }, |
| 172 | |
| 173 | []( leaf::error_info const & unmatched ) |
| 174 | { |
| 175 | std::cerr << |
| 176 | "Unknown failure detected" << std::endl << |
| 177 | "Cryptic diagnostic information follows" << std::endl << |
| 178 | unmatched; |
| 179 | } ); |
| 180 | } |
| 181 | |
| 182 | return 0; |
| 183 | } |
nothing calls this directly
no test coverage detected