[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: Conditional lua_yield
From:       "Duncan Cross" <duncan.cross () gmail ! com>
Date:       2008-10-31 10:54:50
Message-ID: db3aeaf60810310354g78ca409fm834970b614d194a5 () mail ! gmail ! com
[Download RAW message or body]

On Fri, Oct 31, 2008 at 10:46 AM, Enrico Colombini <erix@erix.it> 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

[Attachment #3 (text/html)]

On Fri, Oct 31, 2008 at 10:46 AM, Enrico Colombini <span dir="ltr">&lt;<a \
href="mailto:erix@erix.it">erix@erix.it</a>&gt;</span> wrote:<br><div \
class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid \
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> The manual states \
that lua_yield &quot;should only be called as the return expression of a C \
function&quot;.<br> <br>
Can I have a conditional yield on return? e.g. is this valid or could it give trouble \
(possibly depending on the compiler)?<br> <br>
&nbsp;if (mustYield) {<br>
 &nbsp; &nbsp; return lua_yield(lua, 0);<br>
&nbsp;} else {<br>
 &nbsp; &nbsp; return 0;<br>
&nbsp;}<br>
<br>
I suppose so, but just to be safe...<br><font color="#888888">
<br>
 &nbsp; Enrico<br>
</font></blockquote></div><br>Yes, that&#39;s fine.<br><br>-Duncan<br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic