lua-users home
lua-l archive

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




On Saturday, May 17, 2014, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> I want something like |local v = t?t1?t2?t3|... (actually I want
> |local v = t?.t1?.t2?.t3|...)

Another option:

   local v = (((t or E).t1 or E).t2 or E).t3

(where E={} is defined somewhere in your code...)


For practical use cases that I've run into, where it's only one or two points in the chain, this solution would work for me. 

Thank you! 

-Andrew 
-- Roberto