lua-users home
lua-l archive

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


> > local emptytable = {}
> > local function Opt (t) return t or emptytable end
> > 
> >   if config.Opt(network).Opt(server).url then
> >     dosomething(config.network.server.url)
> >   End
> That does not make any sense. I do not know what I was thinking. Sorry
> for the noise...

Well at least it illustrate what I meant by 'context'. Opt() is "in the middle path/table traversal" while the last ".url" is "the final access". If metamethods __index / __newindex did provide this kind of information then  it would be easy to implement safe navigation operator with metatables
Would that be something completely unrealistic to provide more contextual information as parameters of the __index / __newindex metamethods ?