@@ -162,14 +162,14 @@ template <typename Derived> class LuaThreadImpl {
162162 if (argnum < 0 ) {
163163 argnum = 0 ;
164164 }
165- int result = lua_resume (thread, state, argnum);
165+ int nresult = 1 ;
166+ int result = lua_resume (thread, state, argnum, &nresult);
166167 except::checkErrorAndThrow (result, thread);
167- return detail::FunctionResultProxy::ReturnValue (thread, result, 1 ,
168+ return detail::FunctionResultProxy::ReturnValue (thread, result, nresult - ( lua_gettop (state) + 1 ) ,
168169 types::typetag<Result>());
169170 }
170171 template <class ... Args> FunctionResults operator ()(Args &&... args);
171172#else
172-
173173#define KAGUYA_RESUME_DEF (N ) \
174174 template <class Result KAGUYA_PP_TEMPLATE_DEF_REPEAT_CONCAT (N)> \
175175 Result resume(KAGUYA_PP_ARG_CR_DEF_REPEAT(N)) { \
@@ -194,9 +194,10 @@ template <typename Derived> class LuaThreadImpl {
194194 if (argnum < 0 ) { \
195195 argnum = 0 ; \
196196 } \
197- int result = lua_resume (thread, state, argnum); \
197+ int nresult = 1 ; \
198+ int result = lua_resume (thread, state, argnum, &nresult); \
198199 except::checkErrorAndThrow (result, thread); \
199- return detail::FunctionResultProxy::ReturnValue (thread, result, 1 , \
200+ return detail::FunctionResultProxy::ReturnValue (thread, result, nresult - ( lua_gettop (state) + 1 ), \
200201 types::typetag<Result>()); \
201202 }
202203
0 commit comments