Lua?
2007-03-06 16:28:07.486566+00 by
Dan Lyke
4 comments
Anyone heard things about Lua? Rafe reports that 40% of Adobe Lightroom is written in it, it's the scripting language behind World of Warcraft, and as software development goes more and more towards "write most of the app in something other than C/C++" I want to stay ahead of the curve on this stuff.
[ related topics:
Software Engineering
]
comments in ascending chronological order (reverse):
#Comment Re: made: 2007-03-06 17:21:32.282923+00 by:
other_todd
[edit history]
It's a student-developed language done initially as a project at a Portuguese university. The procedural elements are similar to every other language you've worked with (i.e. function ... end, if ... end, so on) but the data handling is a bit tricky. Where Lua differs from, say, Perl, is that the handling of data as objects is far more built-in, and slinging around hashes/associative arrays/named arrays (I mean for all three of those to be synonyms here) is far easier in Lua than in most other languages IF you can get used to its extremely compact notation.
Here's a quick sample of slinging data around in objects -
function FloorGroup (l)
local list = l.list or {l.name}
editor.DefineFloorGroup(l.name, l.descr, getn(list), list)
end
That is, you pass in an object called l, no typing implied or needed, and your local variable 'list' is a copy of l's 'list' variable if it exists or l's 'name' if it doesn't. This function then passes to another function which is contained within editor.lua (the script files themselves - 'chunks' - can be manipulated as pseudo-objects). I believe getn() returns the number of items in a list.
In short it is really good for slinging around blocks of named, structured data - if, like me, you find that you are frequently working with Perl hashes of arrays of hashes of arrays of hashes [...] then Lua has definite charms. I know very little about its performance etc, or its other weakness.
If you'd like to look at a nice chunk of Lua, I suggest you download the game Enigma at http://www.nongnu.org/enigma/ - you don't need to download the source code, just the minimum installer. The game's central engine (the EXE) basically is a loader/reader; a lot of the initialization and other self-contained functions are provided as .lua files (and no, the game is not notably slower for interpreting them on the fly). The level maps themselves are XML.
#Comment Re: made: 2007-03-06 20:23:53.205114+00 by:
dexev
I played with lua a little bit last year, to use as a end-user-facing configuration language for one of our products. It's easy to lock down to just the functions you want to expose, and to pass data to and from other languages (well, python I can vouch for, but other ones too, supposedly). It didn't seem to provide a lot of structure, so it would take a lot of programmer discipline to write anything large with it.
#Comment Re: made: 2007-03-07 02:22:34.626241+00 by:
DaveP
Lua has also been picked up by many games, especially on the PSP. The guys who are using it at work are
pretty darned happy with it. From the sound of it, it's the kind of thing that a guy can pick up pretty
quickly.
#Comment Re: made: 2007-03-07 19:27:22.514682+00 by:
Shawn
Echoing DaveP, I know that Amaze Entertainment uses it as the scripting language for their games. (I have a friend who works there.) I want to say that it's also what Maya uses for scripting.
I looked at it when I was considering a job at Amaze, but didn't get around to actually playing with it.