[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_sethook, lua_yield and luaL_unref
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 8 Jun 2012 10:23:50 -0300
> Lua flags a stack overflow assertion in the following simple code
> (both in 5.1 and 5.2). It is a small extension to the previous
> example, but this one keeps a reference to thread L in the registry:
>
>
> [...]
>
> Is L in some invalid state after yielding in the hook? Is the stack
> not usable? Is the registry corrupt?
Yes, L is in an invalid state, because it yielded. While it is suspended,
you cannot change its stack. More specifically, the thread "thinks"
it is running a Lua function (because it was inside a Lua function when
it yielded), so it is not ready to accept API operations.
-- Roberto