lua-users home
lua-l archive

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


On 18 June 2012 10:21, Patrick Masotta <masottaus@yahoo.com> wrote:
>
> I’m new to LUA but I have good programming experince..
>
> 1) I couldn’t believe when I saw LUA arrays indexed from “1”; that’s for kids not for programmers.
>
> LUA is developed in C, there’s a lot of effort going on integrating LUA with C/C++ then why this?

http://lua-users.org/wiki/CountingFromOne

> 2) Why you guys do not use {} instead of the wordy BEGIN END sequences???
>
> No matter that modern IDE’s auto-completion save us the extra work punching more characters, The real problem is when we have to read LUA code instead; The bloated text makes harder to understand the code lay-out

There's no "BEGIN" in Lua and "end" is 3 characters. Using "end"
instead of braces avoids having the brace symbols conflated with table
constructors/literals. I find this helps balance things a lot when
both are nested together and definitely *helps* readability rather
than hinders it. "bloated" is stretching it a bit.

> 3) Why there’s not a switch statement?

Because it accomplishes exactly the same thing as a series of if/else
blocks. There's a strong tendency in Lua to avoid doing the same thing
in 2 slightly different, non-complimentary ways. There's also a strong
tendency to favour simplicity instead of satisfying everyone's
whimsical feature requests.