[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: __index returns truncated to one, why?
- From: Sean Conner <sean@...>
- Date: Thu, 10 Apr 2014 13:20:11 -0400
It was thus said that the Great Thiago L. once stated:
>
> >>I just realised this could be another case for my old suggestion [1]
> >>about '...' as a suffix operator which means, explicitly, "do not
> >>truncate this list of values". My original suggestion was for function
> >>call arguments, so:
> >>
> >> func(a()..., b, c)
> >>
> >>...would not truncate the return values of a(), as it normally would.
> >>But another case could be for this case, so:
> >>
> >> local a, b, c = t[1]...
> > t = { 'one' , 'two' , 'three' }
> > local a, b, c = t[1]...
> >
> > a == 'one', that's fine.
> >
> > What does b and c equal?
>
> Whatever ({mt.__index(1)})[2] and ({mt.__index(1)})[3] would be...
Well, two things:
1) the syntax is t[1]... (note trailing dots) which is meant to
indicate multiple values starting at the given index (from what I
understand the proposal to mean).
2) there is no metatable.
Another question:
t = { one = 1 , two = 2 , three = 3 }
local a,b,c in t['one']...
What does b and c equal?
-spc
- References:
- __index returns truncated to one, why?, duz
- Re: __index returns truncated to one, why?, Dirk Laurie
- Re: __index returns truncated to one, why?, Andrew Starks
- Re: __index returns truncated to one, why?, steve donovan
- Re: __index returns truncated to one, why?, Dirk Zoller
- Re: __index returns truncated to one, why?, steve donovan
- Re: __index returns truncated to one, why?, Duncan Cross
- Re: __index returns truncated to one, why?, Sean Conner
- Re: __index returns truncated to one, why?, Thiago L.