| 268 | template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename Ret0, typename... Ret, typename... Args, |
| 269 | typename Fx, typename... FxArgs> |
| 270 | inline int call_into_lua(types<Ret0, Ret...> tr, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) { |
| 271 | if constexpr (std::is_void_v<Ret0>) { |
| 272 | call<check_args>(tr, ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...); |
| 273 | if constexpr (clean_stack) { |
| 274 | lua_settop(L, 0); |
| 275 | } |
| 276 | return 0; |
| 277 | } |
| 278 | else { |
| 279 | (void)tr; |
| 280 | decltype(auto) r |
| 281 | = call<check_args>(types<meta::return_type_t<Ret0, Ret...>>(), ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...); |
| 282 | using R = meta::unqualified_t<decltype(r)>; |
| 283 | using is_stack = meta::any<is_stack_based<R>, std::is_same<R, absolute_index>, std::is_same<R, ref_index>, std::is_same<R, raw_index>>; |
| 284 | if constexpr (clean_stack && !is_stack::value) { |
| 285 | lua_settop(L, 0); |
| 286 | } |
| 287 | return push_reference(L, std::forward<decltype(r)>(r)); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename Fx, typename... FxArgs> |
| 292 | inline int call_lua(lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) { |
no test coverage detected