help with lua style and syntax
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: help with lua style and syntax
 
- From: "David Collier" <myshkin@...>
 
- Date: 2012年10月18日 13:18 +0100 (BST)
 
in C I can write:
 if ( passed = myFunction( x , y , &z ) )
 && ( passed = mySecondFunction( z, &q ) )
 
which is preferable to
 passed = function(x, y, &z)
 if ( passed )
 {
 passed = mySecondFunction( z, &q ) )
 
---------------------------
Now Lua allows me to return more than one value, so I can write
 passed, z = myFunction(x, y)
 
but is there any way in Lua I can write
 if passed, z = myFunction(x, y)
 
and set both passed and z, but then test 'passed' ??
It would allow me to do:
 if ( passed, z = myFunction(x, y) )
 and ( passed, q = mySecondFunction(z) )
 and ( passed, result = myThirdFunction(q) )
which is a lot more comapct than what I'm writing at present.