Re: LUA Coroutines (from C/Lua/C callbacks)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: LUA Coroutines (from C/Lua/C callbacks)
- From: Rici Lake <lua@...>
- Date: Wed, 3 Aug 2005 22:30:00 -0500
On 3-Aug-05, at 10:18 PM, Shaun wrote:
Hi,
I've been watching the discussion regarding coroutines with interest.
Does anyone have any idea if the Resumable VM Patch
(http://lua-users.org/wiki/ResumableVmPatch) 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.