lua-users home
lua-l archive

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


Lua, like most of the newer, dynamic languages, allows you to create
mini-languages much closer to the domain of your business problem than
their traditional object-oriented counter parts. 

Lua delivers on the promise of object oriented programming by allowing
you to write programs in terms of your business model as opposed to your
hardware and OS model, without having to resort to object-quackery like
dynamic casts and type introspection.
 
This has an advantage when you need to implement a user requirement.
Instead of thinking about the amount of memory you need to allocate or
whether you're going to pass by reference or copy, you find yourself
thinking of how the tax should be calculated for the order or where the
button should be on the screen. 

This level of abstraction does wonders for creating rapid prototypes,
user scripting layers, configuration, and UI. These are the areas where
I think Lua excels.

So where shouldn't you use it? 

I would be wary of using Lua in real time environments where every byte
needs to be accounted for, every loop needs to be tight, and you can't
afford to lose perfect control. 

The same goes for systems that demand speed. Fast as Lua is, you aren't
going to beat plain old C for image processing or modeling.

Finally, I don't think the language makes much sense if you're just
re-implementing functionality provided by your underlying OS. Anywhere
where you're not providing an abstraction is a bad place to use Lua.
Leave those WM_PAINTS out of your pristine business code. 

-Dustin

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Ken Smith
Sent: Tuesday, September 26, 2006 3:34 PM
To: Lua list
Cc: lua-l@lua.org
Subject: Re: When to use Lua

On 9/26/06, Jason T. Slack <appleslack@gmail.com> wrote:
>
> I stumbled upon Lua when reading about Adobe Lightroom.
>
> I write a text editor and backup software, under what circumstances
> would I want to use Lua in my applications? What does it do for me?

This is a big question but, as a very new Lua user, let me tell you
places where I will use Lua from now on.

 - configuration files
   Forget .ini and its ilk.  Lua is simple and lightweight enough to
use for this
   basic service.

 - exposing program internals to savvy end users
   Perhaps your editor could use a scripting language for automation?

 - real programs
   In the future, when I write a program in C or C++, I will do all I
can to
   write the bulk of it in Lua and only use C/C++ to expose otherwise
unavailable
   system internals.  Hashtables are the king of datastructures and I
starting to
   wonder why I ever need anything else :)

  Ken Smith