Re: Long chains of objects (aka tables)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Long chains of objects (aka tables)
 
- From: Coda Highland <chighland@...>
 
- Date: 2014年5月17日 10:37:33 -0700
 
On Sat, May 17, 2014 at 10:34 AM, Petite Abeille
<petite.abeille@gmail.com> wrote:
>
> On May 17, 2014, at 7:07 PM, Thiago L. <fakedme@gmail.com> wrote:
>
>> I want something like |local v = t?t1?t2?t3|... (actually I want |local v = t?.t1?.t2?.t3|…)
>
> Why don’t you simply write a little function that does exactly that then?
>
> v = get( t, ‘1.2.3.4.5.6.7.8.9’ )
>
As mentioned earlier in the thread... performance. The nil metatable
hack is substantially faster than actually implementing the necessary
logical checks (e.g. a and a.b and a.b.c).
/s/ Adam