lua-users home
lua-l archive

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

On 3-Aug-05, at 10:18 PM, Shaun wrote:


I've been watching the discussion regarding coroutines with interest.

Does anyone have any idea if the Resumable VM Patch ( will make it in to the next release of LUA? The ability to properly yield from C callback functions is pretty crucial for my application but I'd rather avoid merging a fork of the mainline.

One solution I've used to get around the problem of yielding from callbacks is to simply turn it on its head: instead of yielding from the C callback, you yield to the C callback. (That is, instead of callback(args), you issue coroutine.yield(callback, args), but you can hide that inside a convenience function so that it actually looks like callback(args).)

Of course, you still need to deal with saving state in the callback handler.