lua-users home
lua-l archive

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



On Sun, May 31, 2020 at 11:20 AM Joseph C. Sible <josephcsible@gmail.com> wrote:

I'm not sure, though, whether this is a bug in Lua, or just that
you're not supposed to use lua_resume on the main thread.


You can only resume a coroutine that's in the right state, it either should not have started yet, or it should have yielded. You cannot resume a thread that resumed another one, a thread that resumes another one will only restart if the thread it resumed yields or exits.

For more information about Lua's asymmetric coroutine see this article: http://www.lua.org/doc/jucs04.pdf


--