[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: yet another lua suitability question
- From: Javier Guerra <javier@...>
- Date: Wed, 21 Dec 2005 08:59:27 -0500
On Wednesday 21 December 2005 8:36 am, Roberto Ierusalimschy wrote:
> > Am I right in assuming that any general purpose programming done in
> > Lua needs working knowledge of building Lua in C? And so if you can't
> > make that commitment, you should choose another language?
> Not at all. One of the main benefits of using Lua is not having to use
> C. You only need to know C if you are going to write a new library that
> interfaces with C. As long as you use available libraries (such as
> WxLua) you do not need any knowledge of C.
the important thing is having the right libraries... and recognizing them.
for example, let me tell my own experience of getting to know (and love!)
i had a somewhat complex project in mind; i had already visualized most of the
layers it would need, and the basic primitives i'd need. but the higher
level layers would need to be easily modified and customized. that called
for a good scripting language.
i had lots of experience in low level languages (C and C++ my favorites), but
limited scripting ones (usually PHP, Perl, or Bash). at first i thought i'd
be able to use mostly Bash and a little PHP, but it got messy to work with
arbitrary filenames (with spaces and symbols in the name). that kind of
things are totally trivial in C, so i went looking for a different language
that could be better integrated with C.
at first, i liked Pike, but the integration mechanism didn't 'click' in my
mind... unlike Lua, which was like the perfect extension to C.
so, i did most of that project with a simple executable that exposed most of
it's functionality as Lua functions. it needed some MySQL functionality, so
i copied and pasted some LuaSQL code into my source... didn't have time to
make it work as a loadable module.
after that project, i really liked Lua; so most of my 'useless dabblings' from
then on were always in Lua.... and less C each time. now, even a somewhat
bigger project, like the Xavante web server doesn't have a single line of C.
in recent days, i've needed to use some C libraries (to manage RDF and TIFF
files), but now it's easier to me to just write a loadable module to access
it in Lua, and go on.
soon, i might rewrite most of that original project, but this time, i won't
try to build an executable that could be scriptable with Lua. now i want it
to be pure lua with some 'standard' additions (posix, sql, RDF, web, etc).
> However, if you really need some kinds of extra facilities (like new
> widgets) or something that has no library available yet, then you must
> work with C.
as you can see (if you managed to read all this); having some C experience
lets you say "i don't have this, let hack it out!", but if you don't have
time to do that... it shouldn't be hard to get someone to do it for you!
you mention XPath capabilities; there's already luaExpat, maybe it wouldn't be
hard to extend it... or write a new module. my LuaRDF module took just a
couple of days of writing (once i understood the Raptor library)
Description: PGP signature