Re: Yielding coroutines from C using coco patch
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Yielding coroutines from C using coco patch
- From: Tobias Markmann <tmarkmann@...>
- Date: 2009年1月18日 13:36:05 +0100
On Sun, Jan 18, 2009 at 1:28 PM, Enrico Colombini
<erix@erix.it> wrote:
Tobias Markmann wrote:
lua_yield(L, 0);
printf("After yield\n");
return 0;
If I understood correctly, here's what the manual says of lua_yield():
This function should only be called as the return _expression_
of a C function, as follows:
return lua_yield (L, nresults);
You can't insert a printf after the yield. If you have to, return normally and do a coroutine.yield on the Lua side (I used both methods and they work fine).
Enrico
I thought the coro patch enables writing normal C methods and yield from/resume to them.
In particular you can now:
- Yield from C functions and resume back to them.
And if that's not possible, how else can i handle it? I mean I need to be able to pass stuff to C when yielding and pass stuff back to Lua when resuming, in some way.
Cheers,
Tobias