[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Depth indexing of nil
- From: Petite Abeille <petite.abeille@...>
- Date: Thu, 9 Jul 2015 18:52:24 +0200
> On Jul 9, 2015, at 3:10 AM, Simon Green <Simon.Green@2degreesmobile.co.nz> wrote:
> Basically, what I'm asking is, if 'b' doesn't exist, is there a way to have a.b.c.d.e == x just return false instead of break my entire program?
Sure, if this is something you do often, that’s what convenience functions are for, e.g. GetPath( aTable, ‘a.b.c.d.e.f.g’ ), which will break the path on the dots, and try to resolve the successive keys, returning whatever it can reach. No point of overthinking it.