[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple return values and multiple arguments
 
- From: Geoff Leyland <geoff_leyland@...>
 
- Date: Fri, 8 Apr 2011 21:57:44 +1200
 
On 8/04/2011, at 9:52 PM, Francois Xavier Roure wrote:
> if we execute the following code:
> function toto()
>  return "a", "b", "c"
> end
> print(toto(), toto())
> 
> is it normal to get
> a    a    b    c
> as result instead of
> a    b    c    a    b    c
> ?
Yes.  In this case Lua only keeps multiple return values from a function if that function is the *last* argument to the function you're calling.  See http://www.lua.org/manual/5.1/manual.html#2.5