MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / call_into_lua

Function call_into_lua

extlibs/sol3/include/sol/sol.hpp:14511–14529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14509
14510 template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename Ret0, typename... Ret, typename... Args, typename Fx, typename... FxArgs>
14511 inline int call_into_lua(types<Ret0, Ret...> tr, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {
14512 if constexpr (std::is_void_v<Ret0>) {
14513 call<check_args>(tr, ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...);
14514 if constexpr (clean_stack) {
14515 lua_settop(L, 0);
14516 }
14517 return 0;
14518 }
14519 else {
14520 (void)tr;
14521 decltype(auto) r = call<check_args>(types<meta::return_type_t<Ret0, Ret...>>(), ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...);
14522 using R = meta::unqualified_t<decltype(r)>;
14523 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>>;
14524 if constexpr (clean_stack && !is_stack::value) {
14525 lua_settop(L, 0);
14526 }
14527 return push_reference(L, std::forward<decltype(r)>(r));
14528 }
14529 }
14530
14531 template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename Fx, typename... FxArgs>
14532 inline int call_lua(lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {

Callers 1

call_wrapper_variableFunction · 0.85

Calls 2

lua_settopFunction · 0.85
push_referenceFunction · 0.85

Tested by

no test coverage detected