lua-users home
lua-l archive

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




On Saturday, May 17, 2014, Thiago L. <fakedme@gmail.com> wrote:

On 17/05/2014 12:51, Roberto Ierusalimschy wrote:
Well it seems to be WAY faster... It would be nice to see it in
vanilla Lua...
It seems it is already there, or did you need a non-vanilla Lua to run
that?

-- Roberto

I mean a ?. operator...


If you set the nil metatable to return nil (thanks for the bug report in my example)  then all kinds of helpful errors dissapear.  I played with this for a bit and productivity tankened. As is, Lua doesn't have a more terse/clear way than:

if a.b and a.b.c.d and a.b.c.d.e then
...

In this example, the op is looking for:
if a.b?c.d?e then
...

Where a==nil would error. 

This is something that I would think would make code clearer. 

-Andrew