[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion: Lua 5.3 -- Named Return Values
- From: Stéphane Aulery <lkppo@...>
- Date: Tue, 19 Nov 2013 14:26:35 +0100 (CET)
>De: Pierre-Yves Gérardy <pygy79@gmail.com>
>Envoyé: Tue, 19 Nov 2013 10:55:07 +0100 (CET)
>
> On Mon, Nov 18, 2013 at 10:55 PM, Stéphane Aulery <lkppo@free.fr> wrote:
> > I do not know if this is doable, but I would find it convenient to name
> > the return values of functions to facilitate code maintenance.
>
> Something like this?
>
> function add(a, b) returning c
> c = a + b
> end
Yes, or like that :
function (s1, s2)add(a, b)
s1 = a + b
s2 = a * b
end
sum1, sum2 = add(3, 8)
sum1, sum2 = (s1, s2)add(3, 8)
sum2 = (s2)add(3, 8)
--
Stéphane Aulery