lua-users home
lua-l archive

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


It was thus said that the Great Sean Conner once stated:
> 
>   which immediately shows a problem (or at least I see a problem):
> 
> 	function foo(x,y)
> 	  local x,y = x or return nil,"error",y  --- ... um ... 
> 	end
> 
>   Question:  if you call foo(nil,3) does this return nil or nil and "error"? 
> If you call foo(2,2) is x 2 and y "error", or 2?  Well, parenthesis can
> clear that up:
> 
> 	local x,y = x or (return nil,"error") , y

  Actually, the parenthesis may not fix the problem---that might require
another language change.  But *this* is allowed:

	local x,y = x or return nil,"error";,y

  So we're still good.  

  -spc (Um ... more or less ... )