Conditional lua_yield

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Conditional lua_yield

Enrico Colombini
The manual states that lua_yield "should only be called as the return expression of a C function".

Can I have a conditional yield on return? e.g. is this valid or could it give trouble (possibly depending on the compiler)?

 if (mustYield) {
     return lua_yield(lua, 0);
 } else {
     return 0;
 }

I suppose so, but just to be safe...

   Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Conditional lua_yield

Duncan Cross
On Fri, Oct 31, 2008 at 10:46 AM, Enrico Colombini <[hidden email]> wrote:
The manual states that lua_yield "should only be called as the return _expression_ of a C function".

Can I have a conditional yield on return? e.g. is this valid or could it give trouble (possibly depending on the compiler)?

 if (mustYield) {
    return lua_yield(lua, 0);
 } else {
    return 0;
 }

I suppose so, but just to be safe...

  Enrico

Yes, that's fine.

-Duncan