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.