[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: The World According to Lua: How To?
- From: Christian Vogler <Christian.Vogler@...>
- Date: Fri, 18 Feb 2005 21:39:58 -0500
On Friday 18 February 2005 09:07 pm, David Given wrote:
> Both of these highlighted Lua's problems as an application programming
> language; basically, it's not scalable. It's very, very good at writing
> *small* pieces of code and very, very bad at writing *large* pieces of
> code.
YMMV, but I disagree. We use Lua as a control and glue language for a complex
C++ project that implements deformable 3D models. Most of these tasks fall
into the extension category, but the application that we most frequently use
is a 3D OpenGL model visualizer that uses the C++ core to manipulate the
models. The visualizer component is written in pure Lua, extensible, modular,
integrates with other applications out of the box, and has grown to
approximately 5,000 lines of code over time, which cannot exactly be called
small anymore. We never had any particular maintenance problems with it.
> Lua's biggest problem when writing large applications is the hoary old
> chestnut of misspelt global variables. It's *amazingly* painful not to be
> warned if you misspell a variable name... your program just doesn't work,
> sometimes in strange ways. A lesser problem is the fact that variables are
> global unless specified local, which is the opposite to most other
> languages.
Well, I think this is losing track of one of the main selling strengths of
Lua: it lets you customize and set the policies that you want or need.
For instance, the misspelled name problem is one of the problems that the _G
table, and the __newindex/__index metamethods address. Beside metamethods,
function objects and closures are another main vehicle for encapsulation.
Together, they are amazingly powerful and - in our experience - make Lua
quite suitable for larger applications. The difference between Lua and e.g.
Python in this respect is that with Lua, it is you who is in charge of
setting policy, instead of the language designers.
IMHO the only real drawback of Lua as an application programming language is
its relative lack of standard libraries. What happened to the LuaCheia
project, by the way?
Best regards
- Christian
--
Christian Vogler, Ph.D.
Research Scientist, Gallaudet Research Institute
http://gri.gallaudet.edu/~cvogler/