lua-users home
lua-l archive

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


Emeka <emekamicro@gmail.com> writes:

> Hello All,
>
> I am a student at Nathan University, and I chose Lua as my language of
> interest. I would like to know what really make this language unique? What
> did it bring to the table of programming languages? Special features.
>
> Regards, \Emeka
> -- 
> *Satajanus  Nig. Ltd
>
> *

Here's an answer I wrote on stackoverflow that gives some of the
reasons I like Lua (the actual question was "Lua vs. lisp", so the
answer is focused towards that).

http://stackoverflow.com/questions/7919763/lua-vs-embedded-lisp-and-potential-other-candidates-for-set-based-data-processi/7927730#7927730

Lua:

1. Is very small, both source and binary, an order of magnitude or
   more smaller than many more popular languages (Python etc). Because
   the Lua source code is so small and simple, it's perfectly
   reasonable to just include the entire Lua implementation in your
   source tree, if you want to avoid adding an external dependency.

2. Is very fast. The Lua interpreter is much faster than most
   scripting languages (again, an order of magnitude is not uncommon),
   and LuaJIT2 is a very good JIT compiler for some popular CPU
   architectures (x86, ppc). Using LuaJIT can often speed things up by
   another order of magnitude, and in many cases, the result
   approaches the speed of C. LuaJIT is also a "drop-in" replacement
   for standard Lua: no application or user code changes are required
   to use it.

3. Has LPEG. LPEG is a "Parsing Expression Grammar" library for Lua,
   which allows very easy, powerful, and fast parsing, suitable for
   both large and small tasks; it's a great replacement for
   yacc/lex/hairy-regexps. [I wrote a parser using LPEG and LuaJIT,
   which is much faster than the yacc/lex parser I was trying emulate,
   and was very easy and straight-forward to create.] LPEG is an
   add-on package for Lua, but is well-worth getting (it's one source
   file).

4. Has a great C-interface, which makes it a pleasure to call Lua from
   C, or call C from Lua. For interfacing large/complex C++ libraries,
   one can use SWIG, or any one of a number of interface generators
   (one can also just use Lua's simple C interface with C++ of
   course).

5. Has liberal licensing ("BSD-like"), which means Lua can be embedded
   in proprietary projects if you wish, and is GPL-compatible for FOSS
   projects.

6. Is very, very elegant. It's not lisp, in that it's not based around
   cons-cells, but it shows clear influences from languages like
   scheme, with a straight-forward and attractive syntax. Like scheme
   (at least in it's earlier incarnations), it tends towards "minimal"
   but does a good job of balancing that with usability. For somebody
   with a lisp background (like me!), a lot about Lua will seem
   familiar, and "make sense", despite the differences.

7. Has a simple, attractive, and approachable syntax. This might not
   be such an advantage over lisp for existing lisp users, but might
   be relevant if you intend to have end-users write scripts.

8. Has a long history, and responsible and professional developers,
   who have shown good judgment in how they've evolved the language
   over the last 2 decades.

9. Has a vibrant and friendly user-community.


-miles

-- 
Youth, n. The Period of Possibility, when Archimedes finds a fulcrum,
Cassandra has a following and seven cities compete for the honor of endowing a
living Homer.