lua-users home
lua-l archive

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


Sven Olsen <sven2718@gmail.com> writes:
> Thus my latest excursion into lparser.c.  The idea is to allow ~ to denote
> a "conditional field reference".  When evaluating 'table~key', the result
> is 'table.key' provided that 'table' exists. But if 'table' doesn't exist,
> then 'table~key' evaluates to 'table'.  I fall back on the nonexistent case
> when 'table' equals nil or false, so the semantics match the behavior of
> more standard 'and/or' tricks.

Hmm, how about ".?" instead of "~" (which seems kind of random) ...?
Using ".?", the meaning seems to almost jump out at you...

-miles

-- 
Opposition, n. In politics the party that prevents the Goverment from running
amok by hamstringing it.