[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple return value in __index metamethod
- From: Lavergne Thomas <thomas.lavergne@...>
- Date: Tue, 10 Jul 2007 21:26:33 +0200
On Tue, Jul 10, 2007 at 01:54:28PM -0500, Rici Lake wrote:
>
> On 10-Jul-07, at 1:37 PM, Lavergne Thomas wrote:
>
> >at start I have :
> > value = object[idx]
> >it was simple and elegant. I've hopped for this :
> > value, delta = object[idx]
> >but it's impossible.
>
> Sure, but you could certainly implement it as:
>
> value, delta = object(idx)
>
> Just give object a __call metamethod.
>
Sorry to be so annoying and rejecting your suggestions, but the __call
metamethod is already used in theses objects. (and this also break
compatibility with existing code)
I've just doesn't realize it need so much changes to alow __index to
return multiple values. After looking at the lua code I've take away the
idea of a patch, it imply too much change, too much testing and overhead
just to satisfy my eyes when looking at some small parts of my code ;-)
I will stuck with a new method in my object, an __index shortcut and
try to forgot this dream...
Tom
--
Thomas Lavergne "Le vrai rêveur est celui qui rêve
de l'impossible." (Elsa Triolet)
thomas.lavergne@reveurs.org http://reveurs.org