lua-users home
lua-l archive

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


Javier Guerra wrote:
Lua and JavaScript have a lot in common.  (that's a little surprising,
especially for some like me, that absolutely love Lua and find
JavaScript unforgivably ugly :-)

common points:
- really dynamic language
- all objects are hash tables
- you can access fields like obj.field, or obj[field]
- functions are first-class values
- real closures

differences:
- Lua is more verbose (begin...end vs {...})
- table constructor syntax is slightly different (but easier to read, IMO)
- any value can be a key in a table, not just numbers and strings
(it's great to index by any object, or even by a function/closure)
- real lexical scoping
- OOP is just a little syntax sugar, there's no predefined inheritance style.
- there's no array class (or constructor/prototype), every table can
be (efficiently) used as an array.
- coroutines
- very fast, very compact, very portable, very embeddable C implementation.
- VERY easy to extend with C modules
- LuaJIT

hum.... i think those are the biggest points.
Thanks for the detailed response. It's just what I was looking for.

I have not worked, to any great degree, with Javascript. It just seemed a natural choice. Lua sounds like it has better structure to it's syntax and scoping (which is good) and that alone tends to make me want to go with it. My biggest concern is that there is a body of work out there in JS that can be reused easily that I'm sure doesn't exist for Lua because of it's newness. JS also has the advantage of having been around for a long time so browser support is a non-issue. Is browser support good for Lua? Is there room for concern there over JS?

I guess I'm trying to talk myself into Lua I just don't want to go with something so new I get burned by it. This is a mission critical project (yeah, I hate that term too) and our schedule is nuts (really nuts). I need to pick correctly the first time because I won't get a second chance.

Thanks again!