mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Well, that was a nasty hidden bug. But it's all clean now!
This commit is contained in:
parent
48ba47b059
commit
d626eb0461
|
@ -36,13 +36,6 @@
|
|||
|
||||
namespace sol { namespace stack {
|
||||
namespace stack_detail {
|
||||
template <typename T>
|
||||
struct is_this_state_raw : std::false_type {};
|
||||
template <>
|
||||
struct is_this_state_raw<this_state> : std::true_type {};
|
||||
template <typename T>
|
||||
using is_this_state = is_this_state_raw<meta::unqualified_t<T>>;
|
||||
|
||||
template<typename T>
|
||||
inline int push_as_upvalues(lua_State* L, T& item) {
|
||||
typedef std::decay_t<T> TValue;
|
||||
|
@ -148,7 +141,7 @@ namespace sol { namespace stack {
|
|||
template<int additionalpop = 0, bool check_args = stack_detail::default_check_arguments, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline int call_into_lua(types<void> tr, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {
|
||||
call<check_args>(tr, ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...);
|
||||
int nargs = static_cast<int>(sizeof...(Args)) + additionalpop - meta::count_for_pack<stack_detail::is_this_state, Args...>::value;
|
||||
int nargs = static_cast<int>(sizeof...(Args)) + additionalpop - meta::count_for_pack<is_transparent_argument, Args...>::value;
|
||||
lua_pop(L, nargs);
|
||||
return 0;
|
||||
}
|
||||
|
@ -156,7 +149,7 @@ namespace sol { namespace stack {
|
|||
template<int additionalpop = 0, bool check_args = stack_detail::default_check_arguments, typename Ret0, typename... Ret, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<meta::neg<std::is_void<Ret0>>::value>>
|
||||
inline int call_into_lua(types<Ret0, Ret...>, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {
|
||||
decltype(auto) r = call<check_args>(types<meta::return_type_t<Ret0, Ret...>>(), ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...);
|
||||
int nargs = static_cast<int>(sizeof...(Args)) + additionalpop - meta::count_for_pack<stack_detail::is_this_state, Args...>::value;
|
||||
int nargs = static_cast<int>(sizeof...(Args)) + additionalpop - meta::count_for_pack<is_transparent_argument, Args...>::value;
|
||||
lua_pop(L, nargs);
|
||||
return push_reference(L, std::forward<decltype(r)>(r));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user