Home Of The Net Nurdz!
Proud Winner of the "I Accidentally Bookmarked it, Honest!" Award 3 Years Running!
Main Menu
The Rest

lua-web2: A simple lua CGI wrapper   Updated: Jan 11, 2006 @ 08:25 pm
lua-web2 is a simple lua interpreter that I've custom built with a bunch of extra code that makes generating CGI scripts easier (when using lua, anyway).

This is the second generation of lua-web (hence the name lua-web2). Like the previous version, it has support for GET and POST forms, multipart form data, file uploads, getting jpeg image dimensions, getting contents of directories, stat'ing files and other random extensions. This version also includes some simple classes that wrap HTML generation, cookie support, and is linked against sqlite3 so that it can support databases.

This is written mostly in pure C, since I'm a master of reinventing the wheel. Parts of the database layer and the html code generator are written in lua, precompiled, and bound to the executable. The upshot of this is that a single binary is all that you need in order to run your scripts. This is a boon if you're using hosting that doesn't provide you the access you need to install perl modules and so on.

At the moment, the only documentation available is contained in the source code, although this may change in the future.

You can download lua-web as source, or pre-compiled binaries (linux x86 only). The binary package contains a dynamically linked binary and a static binary. The dynamic library only needs standard things like the libc and whatnot, so you should try that one first. The binaries were compiled on slackware, but should work on just about any linux distro. The code should compile without troubles on any system that supports both sqlite3 and lua, although I've only ever tested under linux.

To compile the source code, you will need lua 5.0.2 or better and sqlite 3.2.2 or better.

The source download includes a file which gives compilation and installation instructions.

lua-web is, naturally, freely available to anyone who wants it. I doubt anyone is going to get rich off this. I would ask that you don't pass it off as your own, or something. And, if you add anything good to it, or find a bug and fix it, please let me know so that I can roll that back into mine.

There is also no warranty of any kind, including that this will do something that you want and not do something bad, like wipe out your hard drive or something. If anything goes bad, I didn't do it!

The latest version is 2.0.4, which includes the following changes:

  • Modified to use lua-sqlite3 version 0.3. We still use the code internally instead of building the library and then linking to it (since the default wants to do this dynamically).

  • html:link() now allows for generating the onClick field of the anchor tag, which allows for activating javascript when a link is clicked.

[   lua-web 2.0.4 source   lua-web 2.0.4 binaries   lua-web 1.0.3 (historical interest)   ]

Latest Movie Additions
  1. Pirates of the Caribbean: At World's End
  2. Superbad

Added December 4, 2007

Latest Game Additions
  1. Bonnie and Clyde
  2. Chicago Express

Added March 3, 2009

[an error occurred while processing this directive]