Lua is indeed very, very aweseome -- for all the reasons enumerated, and then some.
But your average Rubyist/Pythonista shouldn't be fooled. The ecosystem of Lua assumes you eat C for breakfast, and if you don't, you're going to be looking around for easy, plug-and-play libraries and wondering why they don't exist.
They don't, because in Lua world, you either call C from Lua or embed Lua in C. You don't throw something together in Lua using the happy friendly libraries that others have written for your convenience (often, in C).
I see comparisons being made with Lisp here and there. The most truthful comparison is sociological: as with the Lisp community, the Lua community (which is very friendly, approachable, and helpful) largely assumes you're smart enough to build it yourself. In C.
If that frightens you, you should probably go back to whatever you were doing before.
> The ecosystem of Lua assumes you eat C for breakfast
That's a bit of an exaggeration. There isn't anywhere near the number of libraries that Python and Ruby have, nor anywhere near the general level of quality, but you can do an awful lot without ever touching C. Reams of Lua code have been written to script WoW by people who have no idea how to program in C. In fact, one of the primary design objectives of Lua is to have a language that's simple for non-programmers to learn.
> you're going to be looking around for easy, plug-and-play libraries and wondering why they don't exist.
That's very true. I spent the better part of a year working on open source web development libraries in Lua but eventually gave up because nobody was using them. There are fantastic libraries in Python and Ruby, at this point it's not really worth reinventing the wheel just to do the same stuff, but in Lua.
The interesting thing about the Lua community is that very few people use Lua as their primary day-in-day-out language, which leads to a distinct lack of fanboyism. I think that's in part why so few libraries exist. The typical Lua programmer attitude seems to be, "Why should I rewrite that in Lua when I can just use the one written in <insert language here>?"
> The interesting thing about the Lua community is that very few people use Lua as their primary day-in-day-out language, which leads to a distinct lack of fanboyism. I think that's in part why so few libraries exist.
Yes. The fact that LuaRocks is close to its 300th library illustrates that :)
I am one of the few people who use Lua as their main language, but I still turn to something else for things like Web development (Python + Flask). Maybe this will change with the OpenResty + Lapis stack [1], which is IMO the most interesting thing in Lua Web development since Mercury [2].
Lua actually has lot of libraries dedicated to interoperability with other languages in a system (protobuf, ZeroMQ, ...), which makes it usable as part of a SOA, so you can write your web frontends in something else and still have most of your backend in Lua.
I primarily do web stuff, apis etc. I wanted to use Lua for a new project and basically gave up. I looked at OpenResty and Lapis and really, really wanted to use it but it was a pain to get working and pain to keep working. Not sure if it has matured since the last time I looked at it (2-3 months ago), but at the time I couldn't use it without quite a bit of mucking around.
That said, I would still love to use it if it was even close to ready.
It is improving fast these days. If you have used it months ago it was 0.0.1 and now it is 0.0.3. Still, those version numbers should make it clear you should not use it in production for something serious...
OpenResty itself, on the other hand, is perfectly usable and used in production at large websites such as Taobao (the Chinese eBay / Amazon) and CloudFlare.
> Reams of Lua code have been written to script WoW by people who have no idea how to program in C.
That plays into one of the reasons why there's not a lot of Lua libraries: they're mostly ecosystem-specific. There's quite a few Lua libraries for WoW that aren't inherently tied to WoW, but they aren't packaged in a way that makes them usable anywhere else. People writing code for a specific program that happens to use Lua generally can't use libraries from LuaRocks, so there's no reason for them to care about LuaRocks in any way.
Sadly I'm not sure that there's really any solution to this problem other than just accepting that an embedded language will have a very fragmented ecosystem.
There is much more of a web development community starting to grow in Lua now, largely around openresty. As a community (especially a web dev one) we need to do more to curate and distribute (and document) these. So do try again!
But is that the attitude the community should be taking? Why can't it be both? In fact it would doubly-awesome if that were the case because having a language that has great support for C but can still be used with ease is a gap most languages fail to close because they choose the binary one or the other.
Really, its one or the other by necessity. The things that make a language good for embedding are the opposite of what you want in a general purpose scripting language. Its also unlikely for any language to build great support for c unless thats the purpose of the language (ie, embedding).
Lets consider Lua. Lua uses a prototype based inheritance system and coroutines for concurrency and has basically no standard library. Anyone who uses Lua extensively ends up building their own object/class system in addition to filling out the standard library. This makes sense; an embedded language shouldn't force its object model on its host and it doesn't need a standard library. The host most likely comes with a standard library of its own. The lack of common building blocks and the reliance on external code means Lua will never be a general purpose scripting language because its just too damn hard to reuse code.
The things that make a language good for embedding are the opposite of what you want in a general purpose scripting language
I'm not sure I agree. What you want for embedding is something small, fast, and easily interoperable. What you want for general-purpose programming is powerful, composable abstractions. Lua meets both sets of criteria. It does so by means of exceptionally good design. The fact that it doesn't have the same object model as some other languages doesn't really prove anything, does it? Every well-designed programming language deserves to be thought of on its own terms.
Not having a featureful standard library, on the other hand, certainly is the kind of tradeoff you're talking about. But (a) is it so important to have a standard library as opposed to just pulling in the libraries one needs? and (b) you may be overestimating the difficulty of interfacing with external code in Lua. It's much easier than with other dynamic languages. "Too damn hard" seems an overstatement.
The big question with Lua is whether it's better enough than its peers to overtake them in any area other than embedding. If it is, we should see some sort of killer application of Lua. There is momentum toward an embedded-web-app style a la OpenResty, but also still a high barrier to entry; for one thing, it isn't well documented.
Just like javascript, building an inheritance-based object system in Lua is pretty much the sign that you are fighting the language, rather than using it as it is.
Unlike in javascript, it's possible to build an inheritance-based object system that works almost exactly like Python's in Lua. It's actually a bit trivial. Considering that the language is generally not opinionated even regarding the features it ships with ("you can use 0-based arrays if you want"), this doesn't seem all that bad.
As noted above, when everyone rolls their own object system, integration gets messy. I think it's easier to stick to the basics of using functions and tables.
But your average Rubyist/Pythonista shouldn't be fooled. The ecosystem of Lua assumes you eat C for breakfast, and if you don't, you're going to be looking around for easy, plug-and-play libraries and wondering why they don't exist.
They don't, because in Lua world, you either call C from Lua or embed Lua in C. You don't throw something together in Lua using the happy friendly libraries that others have written for your convenience (often, in C).
I see comparisons being made with Lisp here and there. The most truthful comparison is sociological: as with the Lisp community, the Lua community (which is very friendly, approachable, and helpful) largely assumes you're smart enough to build it yourself. In C.
If that frightens you, you should probably go back to whatever you were doing before.