[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: sunday afternoon whishlist
- From: Peter Cawley <lua@...>
- Date: Sun, 9 May 2010 16:49:53 +0100
On Sun, May 9, 2010 at 4:36 PM, Klaus Ripke <paul-lua@malete.org> wrote:
> Could indexing anything but a table, or at least indexing nil,
> return nil instead of throwing an error?
> I don't see why x.z conveniently gives nil, if there is no z in x,
> but x.y.z requires an extra check for x.y .
> This makes working with structures with lots of optional parts pretty
> tedious - and if it's external input, basically everything is optional.
If you want this, then you can already get it in 5.1 by doing:
debug.setmetatable(nil, {__index = {}})