lua-users home
lua-l archive

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


> 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.