lua-users home
lua-l archive

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


I didn't see any replies, so here's another try...

This code:

function returns_two() return 42, 43 end
function accepts_two( a, b ) print( a, b ) end

accepts_two( returns_two() )

Outputs this:

42   nil

Instead of this:

42   43

I think this is "by design" and has something to do with "return value
adjustment" per section 4.6.8 of the manual.

Question: Is there any way to use this syntax without resorting to
intermediate variables?

Question: Can this syntax be allowed for future versions?

TIA,
ashley


> -----Original Message-----
> From: lua-l@tecgraf.puc-rio.br [mailto:lua-l@tecgraf.puc-rio.br]On
> Behalf Of Ashley Fryer
> Sent: Monday, November 08, 1999 5:40 PM
> To: Multiple recipients of list
> Subject: Forwarding N Return Values
>
>
> Hello lua-l,
>
> This code:
>
> function dest( ... ) print( arg.n ) end
> function source() return 1,2,3,4 end
> dest( source() )
>
> Outputs this:
> 1
>
> Instead of this:
> 4
>
> Is there some way to get this syntax to work?  If not, perhaps
> this could be
> added to the wish-list for the next version?
>
> ashley
>