Has anyone used Lua to build a web application?

I come from the background of Java and PHP to build web applications.

Has anyone used Lua to create web applications ?

Question: If so, what are the pro and con uses of Lua compared to PHP or Java for a web application? (e.g. web server support, performance, code maintenance, etc.).

+6
java php lua
source share
7 answers

As mentioned above, Lua is a do-it-yourself, a kind of environment. In addition, it is very fast and efficient compared to Perl / PHP / Python / Ruby, especially if you use LuaJIT. And it is very easy to integrate with C / C ++ code. Typically, these points are not related to a typical web application, where performance is usually limited by the database. In addition, where you do not really like the C / C ++ integration, and where you really do not want to do something yourself, but rather want to build on top of existing frameworks. For this reason, I do not think Lua is suitable for typical web applications. At the same time, there are some niche applications where Lua shines. For example, our company specializes in creating high-performance HTTP servers used for advertising. So we use our own HTTP server, written from scratch in C ++, which integrates Lua as a scripting language for our business logic. This allows us to quickly customize the business logic in Lua compared to what we had to do if it was pure C ++. At the same time, we always have the ability to make critical components in C ++. If we used any other scripting language, we would be sure that it would be slower, it would use more memory and, as a rule, it would be more difficult to integrate with C ++ code. At the same time, we don’t really care about the loss of extensive library support if we use other scripting languages, since the domain in which we work is quite specialized, therefore, in any case, these libraries have nothing to do with it.

+7
source share

I am using Lua right now to create a web application! No matter what happens to the software developers who "did it themselves," got a bad name - too lazy, taken from the bloated megabytes of support libraries, or what? In fact, as others have noted, there is decent support, not a Python scale. Lua is by far the fastest scripting language (especially with www.luajit.org around) and much, much cleaner than any other language in its league. This is important for long-term service.

For those who use lighttpd as their web server (including me), the added bonus is that the full power of Lua is available for mod_magnet , useful for synchronous request processing / rewriting on steroids.

+6
source share

I have programmed several sites with Lua. The first one was a raid planner for my World of Warcraft guild (often how you start programming in Lua ...). For this, I used mod_lua with the alpha version of Apache 2.4. The other two were small customer competition sites developed with WSAPI, Nginx, Spawn-fcgi, and Orbit. This setting is damned fast, faster than mod_lua and all that I saw. Pages will be displayed instantly, as if they were in the cache! The experience was very enjoyable, and Lua makes you quickly productive. But it’s better to be well organized. Lua lacks a lot of batteries when it comes to web development, so you often have to do your own and it can get messy. Therefore, I suggest you plan what you need before you begin. I used my own Lua "ORM" with MySQL and a forked version of Lua Pages for templates. Have a look here if you want to give Lua + Wsapi + Nginx a try: http://mascarenhas.github.com/2009/10/24/wsapi-nginx-fcgi.html I think this is the best setting.

+4
source share

There are many projects using Lua for web development.

For example, Nanoki , an HTTP engine and wiki developed in pure Lua.

Or Sputnik, which is being built on top of Kepler.

However, Lua is a lot, um, do-it-yourself.

+2
source share

Pros: fast, small, elegant, easy to make your own binding to the C library.

Cons: Sometimes you have to write your own libraries for the things you get for free in Python.

http://luanova.org/ has a number of good publications on web development in Lua.

+2
source share

lighttpd and mod_magnet are a really great platform, but I recommend taking a look at the Kepler Project first . This is a pretty good start.

You can use your PHP / Java background.

0
source share

We use lua with great success for our internal implementation. You can also take a look at the JUCI Web interface for embedded devices. It uses lua to implement the backend. You can see how the code interacts with the lua / C backend: https://github.com/mkschreder/juci

Please note that this backend is a pure jsonrpc file, so it does not create any html pages like php or cgi pages. Lua is perfect if all you do is process and respond to json requests. You can also have the main application in php and use lua to write the application on the server. Or the main application entirely in javascript.

I think that if you intend to use lua in the places where you want to generate html, you will find that it lacks many functions, but if you restrict it to a purely functional backend implementation, you will find that it works very well.

-one
source share

All Articles