Lua/APR

Lua/APR: An extended standard library* for Lua

Lua is a very elegant programming language, both because of its conceptual simplicity and the small size of its implementation, but this small size comes at a price: Lua’s operating system interfaces are quite minimal and (in a sense) this makes Lua a second-class citizen on popular platforms like Windows and UNIX systems. My solution was to write a binding to the Apache Portable Runtime.

Apache Portable Runtime binding for Lua

Lua/APR is a binding of the Apache Portable Runtime (APR) for the Lua programming language. APR powers software such as the Apache webserver and Subversion and Lua/APR makes the APR operating system interfaces available to Lua, serving as an extended standard library.

Why the Apache Portable Runtime?

I was quickly disappointed by the lack of cross platform operating system interfaces!

In 2007 I decided to create a binding to one of

the well known ‘portable runtimes’:

  1. Apache Portable Runtime (APR)

    Very comprehensive, lots of tests

  2. Netscape Portable Runtime (NSPR)

    Seemed less comprehensive than APR

  3. ACE, commonc++, Qt (all C++)

    All disqualified because they’re written in C++

    which is way over my head...

The origins of APR

  1. Started life in the Apache web server code base

  2. Eventually split into a separate library

  3. Insists on using memory pools everywhere

    (which makes sense in a server context)

  4. Very comprehensive, dozens of modules:

    directory handling, filename matching, file I/O, network sockets,

    multi threading, shared memory, process management, signal

    handling, option parsing, cryptography, date handling, relational

    database interfaces, LDAP connection handling, option parsing, ...

参考