lua-users home
lua-l archive

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

>> I've tried a few things along these lines but without much luck. I
>> think the main problem is just that I don't have a good understanding
>> of how yields and resumes operate.
> That really makes things difficult...

Heh, yes, it does. I've read up on setjmp/longjmp, it's just how
they're used by Lua that's a bit beyond me.

>    return lua_yield(L, 0);

Well, I put exactly that after lua_call in the hook function; as I
said before, that was the second thing I tried. (Except that I can't
return the return value of lua_yield, the hook returns void, I just
left off the "return", but it's the last thing the function does.) And
it seemed to never go back to the coroutine, it just re-executed the
hook function every time I resumed.

> As I told you, C hooks are not regular lua_Cfunctions. In particular, you
> cannot use lua_*k functions inside them.

Ah, I didn't realize that. It's not really documented anywhere, is it?