lua-users home
lua-l archive

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


On Wed, Mar 06, 2013 at 03:52:26PM +0530, Muqtheear S wrote:
> Hi I am new to Lua Scripting, Can some body say me "What Lua can do that
> other programming languages can't do?".

It depends on what you mean by "Lua".

To me, Lua is both the language and the API. In that sense, Lua stands out
as heads-and-shoulders above all the other languages in terms of ease of use
from C. I've written Perl modules extensively, and some Python modules. How
does the Lua API standout?

1) coroutines. Lua doesn't play games with your stack, and you can
   use them from the C API just as well as from inside the VM. And
   in fact, Lua is actually unique among the big name languages in
   terms of it's unadultered symmtetric coroutine support.

2) C API. Lua's API is a first-class citizen, and not an after-thought as
   with many other languages. Generally speaking, other languages may make
   it more-or-less easy to write C bindings, but not easy (or even feasible)
   to embed the execution instance inside a larger application.

3) Run-time errors. Exceptions in the Lua VM use longjmp(). This
   means the core VM is carefully written to handle non-local changes in
   control flow. This is hard to do, particularly in C, and requires that
   the authors carefully order changes to the internal state. Among other
   things, it means Lua can handle things like malloc() failure gracefully
   and still return control back to the application while maintaining a
   consistent VM state.

As regards the execution language, Lua really stands out in terms of sheer
quality and simplicity. That's hard to quantify, but if you've been
programming for many years it's quite nice.