lua-users home
lua-l archive

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


On Sat, Jan 5, 2013 at 11:41 PM, William Ahern
<william@25thandclement.com> wrote:
> In the example above, in order to get a.b.c = 5 to work, evaluating
> a.b must return a table. So would a.b.c if all you were doing was checking
> the value. So in Lua a.b.c would return a table, instead of undef as in
> Perl.

yes, in that implementation a.b.c does return a table, but note that
it's not inserted into the parent table until the assignment, and also
that it has a different metatable while not assigned.  this could be
used to distinguish those temporary 'unset' tables from 'real' tables
or values.  for example, it could return true when compared to a
predeclared 'unset' value.

--
Javier