From 4123830e6cde38327a4b387889fb55d6034e7200 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sun, 17 Apr 2016 03:13:46 -0400 Subject: [PATCH] Should probably introduce a `is_push_pop_transparent` trait for things like `is_this_state` ... --- sol/stack.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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)); }