lua-users home
lua-l archive

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


Sorry, I should have mentioned that I return NO results from the
coroutine. The return statement is empty. At every crash, the number
of results is zero, and the lua_checkstack(L, nres+1) call returns
false. So there are not too many results, there just isn't room for 1
more element on the stack. Here is how the code roughly looks.
Everything below is run in a lua_pcall with an error handler.

function run ()
    print("running coroutine...")
    -- ... some things happen here
    dump_stack(action.co) -- coroutine stack has 1 element: thread: 0xaddress
    dump_stack() -- main stack has no elements
    return result -- return value is always either nil, or a short string
end

action.co = coroutine.create(run)

print("preparing to run coroutine...")
dump_stack() -- main stack is empty
local ret = {coroutine.resume(action.co)}
print("coroutine finished.") -- never gets here, instead my error
handler is called with the "too many results to resume." error, and
the stack is filled up with thousands of copies of my error handler,
booleans and the number 1.

Hope someone can see something that I missed, this bug has been a
total nightmare for a week!

Thanks!