Hacker News new | ask | show | jobs
by compay 4689 days ago
> 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>?"

3 comments

> 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].

[1] http://leafo.net/lapis/ [2] https://github.com/nrk/mercury

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!