lua-users home
lua-l archive

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


> My biggest gripe with lua is the lack of libraries that make
> general-purpose scripting hard and verbose.

Or alternatively, which force you to write your own libraries! I've never
found Lua verbose (though admittedly I've not programmed much in other high
level languages with good libraries such as Java, Perl or Python); but I
have found that I've accumulated quite a few utility routines after just a
little Lua scripting. However, a lot of these are very general purpose or
widely useful, e.g. die(), warn(), wrappers for the file routines which call
die on error, and general list operations such as mapping a function over a
list, applying a function to each element of a list, or concatenating two
lists.

> image.0001.pgm
> image.0002.pgm
> ...
> image.0500.pgm
>
> >From this directory we need to find out how many images are there and
> what the first and last frames are. From lua, this turned out to be
> surprisingly hard to do. We eventually settled on a combination of
> system("ls") and the string pattern functions, but the result is
> neither robust (we end up with broken pipes frequently), nor easy to
> understand.

What about using poslib? POSIX has support for dealing with directories.

> We've partially gotten around the problem by giving access to an
> interactive lua interpreter from the main program. This lets us
> inspect and modify code and variables at run time.

This is one of Lua's coolest features. I used it while writing an
(unfinished) Mini-Scheme interpreter, and once I realised I could do it it
was my single most powerful debugging technique.

-- 
http://sc3d.org/rrt/ | maxim, n.  wisdom for fools