MCPcopy Create free account
hub / github.com/DFHack/dfhack / call_and_push_impl

Function call_and_push_impl

library/include/DataFuncs.h:77–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 template<isPrimitive RT, typename... AT, typename FT, typename... ET, std::size_t... I>
76 requires std::is_invocable_r_v<RT, FT, ET..., AT...>
77 void call_and_push_impl(lua_State* L, int base, std::index_sequence<I...>, FT fun, ET... extra)
78 {
79 using DFHack::LuaWrapper::UPVAL_METHOD_NAME;
80 if constexpr (std::is_same_v<RT, void>) {
81 std::invoke(fun, extra..., (get_from_lua_state<AT>(L, base+I))...);
82 lua_pushnil(L);
83 }
84 else
85 {
86 RT rv = std::invoke(fun, extra..., (get_from_lua_state<AT>(L, base+I))...);
87 df::identity_traits<RT>::get()->lua_read(L, UPVAL_METHOD_NAME, &rv);
88 }
89 }
90
91 template<isPrimitive RT, typename... AT, typename FT, typename... ET, typename indices = std::index_sequence_for<AT...> >
92 requires std::is_invocable_r_v<RT, FT, ET..., AT...>

Callers

nothing calls this directly

Calls 3

lua_pushnilFunction · 0.85
lua_readMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected