MCPcopy Create free account
hub / github.com/boostorg/leaf / main

Function main

example/lua_callback_result.cpp:121–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121int 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

Callers

nothing calls this directly

Calls 3

try_handle_allFunction · 0.85
init_lua_stateFunction · 0.70
call_luaFunction · 0.70

Tested by

no test coverage detected