lua-users home
lua-l archive

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


On Mon, Dec 20, 2010 at 12:19:14AM +0200, Greg Falcon wrote:
> (Why should s[1] == s[1][1][1][1]?)
This is an interesting point, but we already have _G == _G._G._G._G
so I think I could learn to live with that particular consequence of
string indexing to yield single-character strings.

> Lua is a pretty tidy language.  
Indeed.  It lacks many "features" of other languages because it does
not need them: statement separators, a bewildering variety of number 
types, classes, ...

Lua is easy to learn because there are so few keywords and they all
mean just what one expects them to mean.  Also, if some hugely popular
language (which may well have been one's previous favorite language) 
has some common keyword or function name that Lua does not use in the 
same way, Lua generally avoids using that name.  So one's previous 
experience is useful rather than confusing.

Compared to some other languages (Perl with those special characters
denoting types!  Fortran in which blanks do not separate!  Python in
which tabs are syntactically significant!) Lua is strikingly free of 
eccentric notions.

One could easily use Lua as a first language in a programming course.

Except for the long lecture you need to explain why you get this:

> s='hello'; print(s[3])
nil

I just can't see why this is beautiful, logical and Lua-like.  I think
it is right up there with the eccentric notions from other languages.  
If s[3] may not be 'l', then I prefer the error message one got in 
Lua 5.0.  

Dirk