lua-users home
lua-l archive

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


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.