Posted by
| David Haley
USA (3,881 posts) Bio
|
Message
| From a technical perspective, Lua is a very clean language with clear, unambiguous syntax, and relatively simple semantics. This means that it is quite easy to learn, especially if you already know how to program. Its underlying architecture is also very simple, which means that it is almost too easy to extend and embed in other programs, which is what Nick has done with MUSHclient. Unlike other languages, MUSHclient talks directly to the Lua interpreter -- it doesn't have to go through some ActiveX interface that lies in between the host (MUSHclient) and the scripting language.
If there is a pain point with Lua, it is the relatively small community compared to, say, Python. The Lua community is extraordinarily competent and helpful -- the language authors themselves are fairly active on the mailing list -- but a small community means a small set of standard libraries. In fact, part of the problem is that (by design) there are no standards imposed for many things.
Object orientation is an example of this. Lua provides the mechanisms to implement any number of object orientation paradigms (inheritance-based, prototype-based, ...). This is wonderful if you need to set up your system based on specific needs. This is kind of terrible if every library uses its own convention: it is much harder to make the libraries talk to each other, because there is no common, standardized encapsulation mechanism.
The other issue is that you need to hunt around a bit more for libraries to accomplish common tasks in Lua. For example, there is no standard, provided way of talking to files beyond simple I/O: there is no mechanism for listing the contents of a directory, getting a file's extension, and so forth. Of course, this can be (and has been) achieved with libraries, and in this case there is a quasi-official filesystem library called "LuaFileSystem", but for other tasks it might not be so clear.
What is Python's advantage over Lua? IMO, it is the rich library and standardized mechanisms. Lua's advantage is its simplicity, small footprint and efficiency (although Python is making very big strides with JIT compilation). There are several things I don't really like about Python but I'm not sure they're very relevant right now.
But the library problem can be fixed. My personal gripe with Lua is the lack of compile-time type verification. Of course, it is kind of inappropriate for me to have this gripe, because this is not something Lua wants or tries to do. (Python has the same problem, as does pretty much any dynamically typed language.)
In my honest opinion, VBScript is inferior in almost every way to languages like Lua or Python. I would never recommend that somebody spend much time on VBScript unless they actually had to (as I have to when I want to write Outlook macros, for example).
Let me try answering your questions specifically now:
1- Why is Lua considered inferior?
Well, frankly, I'm not sure; this is not something I've heard all that often. I think that WillFa is right that it might suffer from the "just a toy" stigma due to being used as a lightweight language in games. In fact, its apparent simplicity can be misleading and make you think you can't actually do much with it. To be honest, I suspect that many people who say that Lua is inferior don't really know it very well. The main problem with Lua is its relatively small library base, but that is being fixed (LuaRocks is a good example of how, for instance).
2- Should I switch?
Well, I would say that you should never consider switching unless you've found a clear reason to. This is true in general. As they say: if it ain't broke, don't fix it. Don't change just for the sake of it. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|