lua-users home
lua-l archive

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


On 2023-04-05 12:56, Schmalzer, Lukas wrote:

What we are suggesting is a yield function in C that works same as
the familiar yield in Lua: When you call resume, the coroutine
continuous after the yield call.

Actually, in days without continuation (Lua 5.1), LuaJIT has developed
a patch named Coco[1], which make this possible. I do not know whether
the patch works with current Lua release or not.

But, as said in Coco's documentation, this needs machine-specific
features. Lua sticks to ANSI C, which provides no way to switch
stack. So continuation may be the best acceptable way to handle
this kind of yielding.

--
Ziyao

[1]: https://coco.luajit.org/