lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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