diff --git a/sol/stack.hpp b/sol/stack.hpp index 690596b6..43adfc70 100644 --- a/sol/stack.hpp +++ b/sol/stack.hpp @@ -38,6 +38,13 @@ namespace sol { namespace stack { namespace stack_detail { +template +struct is_this_state_raw : std::false_type {}; +template <> +struct is_this_state_raw : std::true_type {}; +template +using is_this_state = is_this_state_raw>; + template inline int push_as_upvalues(lua_State* L, T& item) { typedef std::decay_t TValue; @@ -141,7 +148,7 @@ inline void call_from_top(types tr, types ta, lua_State* L, Fx&& template inline int call_into_lua(types tr, types ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) { call(tr, ta, L, start, std::forward(fx), std::forward(fxargs)...); - int nargs = static_cast(sizeof...(Args)) + additionalpop; + int nargs = static_cast(sizeof...(Args)) + additionalpop - meta::count_if_pack::value; lua_pop(L, nargs); return 0; } @@ -149,7 +156,7 @@ inline int call_into_lua(types tr, types ta, lua_State* L, int st template>::value>> inline int call_into_lua(types, types ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) { decltype(auto) r = call(types>(), ta, L, start, std::forward(fx), std::forward(fxargs)...); - int nargs = static_cast(sizeof...(Args)) + additionalpop; + int nargs = static_cast(sizeof...(Args)) + additionalpop - meta::count_if_pack::value; lua_pop(L, nargs); return push_reference(L, std::forward(r)); }