1. Arrays start at 1
2. "begin" & "end" instead of {}
3. No ++, +=, etc.
4. No bitwise operators
5. No "continue" statement
6. Uses "~=" instead of "!="
Those are just the ones I remembered off the top of my head. It goes against so many modern conventions that makes it a pain in the butt to work with.
1. array[0] is syntactic sugar for *(array+0). 0 is an offset from an address, not an index.
Lua has tables. Tables have indexes. Indexes start at 1.
2. a design goal was to be easy for new users, not just existing programmers.
begin/end was borrowed from SQL.
3. Less operators is less to learn. New users are familiar with +, -, *, /. Operators like ++, --, *=,
increase the learning curve. x = x + 1 is not hard to grasp.
4. No bitwise operators because no integers. numbers are
floats.
5. continue statement is not necessary, adds more
complexity.
6. Why should it be '!=' and not '<>'
I'm not sure it goes against modern conventions, but it does go against a few C conventions. Not all languages need to be C like.
6. It's what the most popular languages out there use. It doesn't have to be !=, which is why it's towards the end of my list, but being different than everyone else is even worse for new users, which is the opposite of what you're arguing for.
Now, I don't like JavaScript, but at the moment, it's the best scripting language for embedding out there. I have embedded both lua and v8, and I consider v8 simpler in terms of getting it to work with your code.
It's not my opinion. In any area other than programming, the term index has a specific meaning and indexes start at one. The term used in C for arrays should be called an offset, not an index. It's the wrong word. We called 2^10 a kilobyte too, even though kilo means 10^3.
> Operators like ++, --, *= increase the learning curve. x = x + 1 is not hard to grasp
why the heck not have both? x += y is more elegant than x = x+y. I understand not including ++ (Python) to not enforce 1 as a standard value, but it also doesn't seem to help anyone.
1. Tables in Lua have keys. Any value other than `nil` may be used as a key, including `0` if you so desire.
2. Lua's usage of `begin`/`end` was borrowed from "Modula" according to the HOPL paper[1]. Probably Modula-2, but the timeframe would not exclude Modula-3 as a possibility, though I suppose it doesn't really matter.
3. I find this to be a poor argument, but I've never felt like I was missing out on a whole lot by not having modification operators in Lua, either. It's not something that comes up often enough that the couple extra keystrokes should be a deal-breaker.
4. Lua added integers alongside flonums in 5.3, along with bitwise operators, but it's been possible to configure Lua's number representation at compile time for as long as I can remember. Prior to 5.3, anyone with a usecase that really necessitated bitwise operations could easily add them with a dozen lines of C code, or they could use LuaJIT which has offered bitops for some time.
I agree completely with points 5 and 6; nothing to add there :)
it's funny your numbered list of reasons lua's bad starts with the fact that array indices start at one by convention in lua, and the index for that first complaint is 1.