[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.4.0 (work1) now available
- From: Scott Morgan <blumf@...>
- Date: Wed, 14 Mar 2018 10:01:54 +0000
On 03/13/2018 07:43 PM, Roberto Ierusalimschy wrote:
>> btw, I notice that there is a new keyword, "undef", not mentions in manual,
>> is that just a undocumented feature or the doc just not the latest?
>
> I am grad you asked :-)
...
> t[i]=undef is a special syntax form that means "remove the key 'i'
> from table 't'". You can only use 'undef' in three specific forms:
>
> t[i] = undef -- remove a key from a table
> t[i] == undef -- test whether a table has a key
> t[i] ~= undef -- test whether a table has a key
>
> Any other use of 'undef' gives a syntax error.
So you couldn't do:
function foo()
return undef
end
t[i] = foo()
t[i] = bar or undef
Still, very interesting feature idea.
Scott