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

Function select_member_function_with

extlibs/sol3/include/sol/sol.hpp:17652–17682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17650
17651 template <bool is_yielding, typename Fx, typename T, typename... Args>
17652 void select_member_function_with(lua_State* L, Fx&& fx, T&& obj, Args&&... args) {
17653 using dFx = std::decay_t<Fx>;
17654 using Tu = meta::unqualified_t<T>;
17655 if constexpr (meta::is_specialization_of_v<Tu, function_detail::class_indicator>) {
17656 (void)obj;
17657 using C = typename Tu::type;
17658 lua_CFunction freefunc = &function_detail::upvalue_this_member_function<C, dFx, is_yielding>::call;
17659
17660 int upvalues = 0;
17661 upvalues += stack::push(L, nullptr);
17662 upvalues += stack::push<user<dFx>>(L, std::forward<Fx>(fx), std::forward<Args>(args)...);
17663 stack::push(L, c_closure(freefunc, upvalues));
17664 }
17665 else {
17666 constexpr bool is_reference = meta::is_specialization_of_v<Tu, std::reference_wrapper> || std::is_pointer_v<Tu>;
17667 if constexpr (is_reference) {
17668 auto userptr = detail::ptr(std::forward<T>(obj));
17669 lua_CFunction freefunc = &function_detail::upvalue_member_function<std::decay_t<decltype(*userptr)>, dFx, is_yielding>::call;
17670
17671 int upvalues = 0;
17672 upvalues += stack::push(L, nullptr);
17673 upvalues += stack::push<user<dFx>>(L, std::forward<Fx>(fx), std::forward<Args>(args)...);
17674 upvalues += stack::push(L, lightuserdata_value(static_cast<void*>(userptr)));
17675 stack::push(L, c_closure(freefunc, upvalues));
17676 }
17677 else {
17678 using F = function_detail::member_function<Tu, dFx, is_yielding>;
17679 select_set_fx<false, false, F>(L, std::forward<Fx>(fx), std::forward<T>(obj), std::forward<Args>(args)...);
17680 }
17681 }
17682 }
17683
17684 template <bool is_yielding, typename Fx, typename... Args>
17685 void select_member_function(lua_State* L, Fx&& fx, Args&&... args) {

Callers

nothing calls this directly

Calls 3

pushFunction · 0.85
lightuserdata_valueClass · 0.85
ptrFunction · 0.70

Tested by

no test coverage detected