lua-users home
lua-l archive

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


On Fri, Jun 27, 2008 at 2:33 PM, James Kimble <jkimble@one.net> wrote:
>
> Not trying to start any kind of fire fight AT ALL. Just wanting to compare
> technologies. One I'm familiar with, the other completely new to.

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.

-- 
Javier