[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Suggestion: Lua 5.3 -- Named Return Values
- From: Sir Pogsalot <sir.pogsalot@...>
- Date: Wed, 20 Nov 2013 11:26:28 +0000
I think this sort of thing has an official name... in Ruby the last statement -- what it evaluates to -- gets returned if it isn't explicitly preceded with a 'return '. In Lua you cannot have expressions in the middle of nowhere. You can have s2 = a * b, but you can't have a * b. It might look a tad confusing to have s2 = a * b and expect that value to be returned if you're reviewing the code...
Also, how many values would be returned? Would you look at the statements within the calling function to determine how many of the last-computed values in the called function should be returned?
Might be a little confusing ;> I understand you probably want this for convenience as it makes the code more concise, but I would suggest trying to get used to explicit return statements... I'm not sure upstream Lua would be in favor of this, but best of luck \o/