| 246 | |
| 247 | template <bool check_args = detail::default_safe_function_calls, typename R, typename... Args, typename Fx, typename... FxArgs> |
| 248 | inline decltype(auto) call_from_top(types<R> tr, types<Args...> ta, lua_State* L, Fx&& fx, FxArgs&&... args) { |
| 249 | using expected_count_t = meta::count_for_pack<lua_size, Args...>; |
| 250 | if constexpr (std::is_void_v<R>) { |
| 251 | call<check_args>(tr, |
| 252 | ta, |
| 253 | L, |
| 254 | (std::max)(static_cast<int>(lua_gettop(L) - expected_count_t::value), static_cast<int>(0)), |
| 255 | std::forward<Fx>(fx), |
| 256 | std::forward<FxArgs>(args)...); |
| 257 | } |
| 258 | else { |
| 259 | return call<check_args>(tr, |
| 260 | ta, |
| 261 | L, |
| 262 | (std::max)(static_cast<int>(lua_gettop(L) - expected_count_t::value), static_cast<int>(0)), |
| 263 | std::forward<Fx>(fx), |
| 264 | std::forward<FxArgs>(args)...); |
| 265 | } |
| 266 | } |
| 267 | |
| 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> |
nothing calls this directly
no outgoing calls
no test coverage detected