[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Coroutines with C code that uses callbacks
- From: Irayo <irayo.lt@...>
- Date: Thu, 12 Jul 2007 13:54:08 -0500
Dirk Feytons wrote:
Check out Coco, a true C-coroutines patch for Lua. It involves patching
the actual Lua source, but it's worked well for me so far when I've done
similar tasks to what you're trying to do.
In other words: I would like the clean and simple iterator-style Lua
code but make full use of the 'streaming' behavior of the C library.
This means that in the end I need to be able to transfer the data that
I receive in that callback to Lua somehow. However PiL2 is quite
clear: you can only yield from C when it is called from Lua and the C
function ends with 'return lua_yield(L, nres);' which ofcourse doesn't
match the interface of the library.
I think this will help with what you're trying to do. Please ignore me
if I am wrong. :-)
"* Yield from C functions and resume back to them."