lua-users home
lua-l archive

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

I've written several medium-to-large programs in Lua, and haven't had
any problems with scalability.  It does take some discipline, but so
does writing a large program in C++.

As for the "biggest problem" that you identified, it's easily remedied
with the following:

setmetatable( _G, { __index = function(t, k) error( "accessing
undeclared global variable '" .. k .. "'", 2 ) end } ) 

I always do this when developing anything non-trivial, and it's saved me
countless times.


-----Original Message-----
From: David Given [] 
Sent: Friday, February 18, 2005 6:08 PM
To: Lua list
Subject: Re: The World According to Lua: How To?

On Friday 18 February 2005 22:11, PA wrote:
> On Feb 18, 2005, at 22:06, Glenn Maynard wrote:
> > I'm not saying one can't; I'm saying one normally does not.  Lua is
> > extension language; extending is what it's good at.  If you're
> > a whole application in it, you'll quickly find out what the
> > is--it's not good at it, and isn't supposed to be.
> Perhaps... time will tell... on the other hand... if people didn't
> experiment with Lua in new and weird ways... Lua would still languish
> as an obscure "data entry language" of sort:

I use Lua as a scripting language, to knock up simple throwaway programs

quickly. The two most complex programs I've written in it are a Makefile

generator --- which works very nicely --- and a C++ preprocessor that
special syntax for our platform. Both of these highlighted Lua's
problems as 
an application programming language; basically, it's not scalable. It's
very good at writing *small* pieces of code and very, very bad at
*large* pieces of code. You can get around this with discipline, but
if I was writing a large application I'd use something else --- Ruby, 

Lua's biggest problem when writing large applications is the hoary old 
chestnut of misspelt global variables. It's *amazingly* painful not to
warned if you misspell a variable name... your program just doesn't
sometimes in strange ways. A lesser problem is the fact that variables
global unless specified local, which is the opposite to most other

Personally, I don't think these are big issues; Lua's not an application

programming language, it's an extension language, and the requirements
different. Perhaps one day it would be nice to have a different compiler
the VM, whose input language had a different emphasis, but I don't see
happening soon. I also don't see Lua's semantics being changed, because
existing semantics are too useful for Lua's primary purpose.

"Curses! Foiled by the chilled dairy treats of righteousness!" ---
Jim (evil)