[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: nil isn't as unique in Lua 4.1
- From: Peter Shook <peter.shook@...>
- Date: Thu, 10 Jan 2002 00:37:35 -0500
I'd rather not have the boolean type because then there will be a need
for functions like Perl's 'defined' (to tell if a variable is not nil)
and 'exists' (to tell if a table has a value for a particular key). How
else with you be able to tell if a variable is false or nil?
In Lua 4.0, it is simple to delegate to another table:
x = t1[i] or t2[i]
If element i isn't in table t1, try t2. But in 4.1, if t1[i] is false,
then this expression will access t2 when you don't really want it to. I
don't want to see Lua start looking like this:
$x = exists $t1{$i} ? $t1{$i} : $t2{$i} ;
- Peter