lua-users home
lua-l archive

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


On Tue Oct 31, 2023 at 2:11 PM EDT, Luna wrote:
> That makes sense. Although, the libraries you mention later seem to be
> backwards-compatible with vanilla Lua coroutines, so would there be any
> problems with just loading those and tricking external libraries into
> using them?

Actually, now that I think about it, that probably stops working the
instant you try to let C code control those coroutines. If a C function
resumes a coroutine, and  then that coroutine tries to yield to a
coroutine that nests that previously mentioned C function, instead of
yielding back to the C function itself, then the C function won't be
able to continue to execute later because coroutines don't exist
natively in C (I hope I wasn't very confusing there).

I wonder if this could even be implemented by the Lua interpreter,
without libraries that use machine code needing to be rewritten.