This page collects a number of my Lua projects:

bit32 library backported for Lua 5.1.4

Here's a version of the bit32 library from Lua 5.2.0, fully back-ported to Lua 5.1.4:

lbitlib-5.2.0-backport4.c

(The bit32 library in Lua 5.2.1 is identical.) On my linux and Mac OS X x86 systems, it passes all the bitwise.lua tests from the Lua 5.2.0 test suite.

libwhy

libwhy is a library for developing applications, using Lua to script GTK+ GUIs. It contains several custom GTK+ widgets which are useful for audio applications. The library may be easily used from C applications, or stand-alone scripts may be executed with the included ylua binary. Several example scripts are included.

libwhy is specialized for use as a platform for my audio and music applications. As a GTK+ binding, it is very incomplete, and lacks documentation. It is licensed under the GNU Lesser General Public License, version 2.1. Unless you need a very lightweight, LGPL-licensed GTK+ binding, I recommend you use lgi instead.

The most current version of libwhy can be had from github:

https://github.com/smbolton/libwhy

The latest release tarball is this:

libwhy-20121103.tar.bz2

Applications which use libwhy include:

ysdl

ysdl is a lightweight SDL binding for Lua 5.1.x. Depending on what you are looking for, it may or may not be of interest to you.

Advantages:

  • simple: only a single C file to include in your application
  • small: many of the most common SDL functions are bound, but not all of them, so the binding isn't larger than Lua itself
  • includes functions from SDL, SDL_image, SDL_mixer, and SDL_ttf
  • Lua function names closely match their SDL counterparts, with predictable changes
  • MIT-style licensing
  • fast: very little type and error checking is done

Disadvantages:

  • unforgiving: very little type and error checking is done; if you pass the wrong argument to a SDL function, you will crash
  • small: if you need something that isn't yet bound, you'll have to add a binding yourself
  • not all SDL functions are bound
  • documentation is minimal

In other words, if you're looking for a complete, hand-holding SDL binding, this isn't it. If you'd like a simple, lightweight SDL binding, and don't mind occasionally adding things on the C side, then ysdl might work for you.

Download:

Example Applications:

Mike Pall's advanced readline patch

I am the maintainer of Mike Pall's advanced readline patch. This patch adds the following features to the existing readline support in Lua 5.x:

  • Completion of keywords and global variable names.
  • Recursive and metatable-aware completion of variable names.
  • Context sensitive delimiter completion.
  • Save/restore the history to/from a file (LUA_HISTORY environment variable).
  • Set a limit for the size of the history (LUA_HISTSIZE environment variable).
  • Set the app name to allow for $if lua ... $endif in ~/.inputrc.

After applying the patch start Lua and try these (replace ~ with the TAB key):

    ~~
    fu~foo() ret~fa~end
    io~~~s~~~o~~~w~"foo\n")
    

The ~~ are just for demonstration purposes (io~s~o~w~ suffices, of course).

The patches have been verified to work with Lua 5.0, 5.0.2, 5.1, 5.2, and 5.3. Compatible readline libraries include GNU readline version from 2.2.1 through 6.2;; Mac OS X libedit 2.11; and NetBSD libedit 2.6.5 and 2.6.9.

You may download the patches here:

http://luajit.org/patches/lua-5.3.1-advanced_readline.patch (works for Lua 5.3.0 also)

http://luajit.org/patches/lua-5.2.0-advanced_readline.patch

http://luajit.org/patches/lua-5.1.4-advanced_readline.patch