lua-users home
lua-l archive

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


Hello,

I'd like to have some info under what circumstances does the "too many
results to resume." error occur? I'm running a coroutine and upon it's
return this error pops up. I put a breakpoint at the error and noticed
that the nres (number of results) is 0, and lua_checkstack(L, nres+1)
fails. So I assumed that my stack was getting trashed somewhere (Is
that assumption wrong?). To find the source of the error I stackdumped
at the end of the function that is being run in the coroutine and got
only one stack element: The thread (coroutine) that is running the
function. I also stackdumped at the actual error (right before it
prints the message) and got a stack filled with A) My error function
that I pass to lua_pall B) Booleans (true and false) C) The number 1.
So somewhere between the return call and the end of coroutine.resume
something goes awfully wrong. My first instinct was to look for
infinite loop/recursion, but couldn't find one. So my questions are:

1) Under what conditions would a "too many results to resume." error
most likely occur.

2) When I dump the stack of the coroutine, the first (only) value on
the stack is the 'thread: 0xaddress' value of the coroutine. This
makes me suspect some sort of infinite recursion is going on, but I
don't know lua internals, so: is the coroutine supposed to be the
first element on it's own stack?

I'd like to give a better context for the code, but it's running in
quite a complex scaffolding, too large to put here.

Thanks for your time.