lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2013/2/15 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
> This is a documentation problem. When a coroutine resumes after the
> first time, the stack cannot contain anything besides the arguments to
> resume. 'nargs' is mostly ignored (except for error handling and API
> checks).

The API could be simplified by removing that nargs argument, to avoid
confusion. For startup it would be lua_gettop(thread)-1 (one being for
the function), and for resuming it would be lua_gettop(thread).

But that's a big API change, so in the meantime I'll call lua_resume
with nargs based on lua_gettop, and I'll make sure I clean up the
stack after lua_resume returned and I'm done with the result values.

Thanks for the answer.