Skip to content
Lua bindings for POSIX APIs
C Shell Lua Makefile
Pull request Compare This branch is 31 commits behind luaposix:master.
Latest commit e5addd4 Nov 20, 2015 @gvvaughan gvvaughan Merge pull request #239 from jimmyharris/fix-termios
Preserve baud rates in termios table
Failed to load latest commit information.
build-aux doc: update opengroup manual links to issue 7 webpages. Jul 4, 2015
examples examples: demonstrate use of pipe and dup2 for fork/exec prep. Oct 16, 2015
ext Preserve baud rates in termios table Nov 20, 2015
gnulib gnulib: sync with upstream. Jan 2, 2015
lib posix: don't leak execx into global namespace. Oct 19, 2015
m4 slingshot: adopt slingshot release mechanism. May 9, 2013
specs specs: add full examples for deprecated posix.getpid behaviour. Aug 26, 2015
.gitignore maint: update .gitignore. Feb 28, 2015
.prev-version maint: post-release administrivia. Mar 1, 2015
.slackid slingshot: synch with upstream, for slack integrations. Aug 26, 2014
.travis.yml slingshot: sync with upstream for Travis Lua 5.3.1 support. Jun 27, 2015
.x-update-copyright maint: update copyright notices to include 2014. Jan 4, 2014
AUTHORS Mention where to look for other contributors. Apr 16, 2013
COPYING maint: update copyrights. Jan 1, 2015
ChangeLog.old Update Github URL. Sep 7, 2012 maint: update Oct 3, 2015
bootstrap.conf configury: set and use HAVE_FDATASYNC for fdatasync support. Aug 23, 2015 install posix/init.lua under posix Feb 28, 2015
rockspec.conf rockspec.conf: remove bogus constraint on bit32 version Feb 28, 2015


By the luaposix project

License travis-ci status Stories in Ready

This is a POSIX binding, including curses, for LuaJIT, Lua 5.1, 5.2 and 5.3; like most libraries it simply binds to C APIs on the underlying system, so it won't work on non-POSIX systems. However, it does try to detect the level of POSIX conformance of the underlying system and bind only available APIs.

luaposix is released under the MIT license (the same license as Lua itsef). There is no warranty.


The simplest and best way to install luaposix is with LuaRocks. To install the latest release (recommended):

    luarocks install luaposix

To install current git master (for testing, before submitting a bug report for example):

    luarocks install

The best way to install without LuaRocks, is to download a github release tarball and follow the instructions in the included INSTALL fill. Even if you are repackaging or redistributing luaposix, this is by far the most straight forward place to begin.

Note that you'll be responsible for providing dependencies if you choose not to let LuaRocks handle them for you, though you can find a list of the minimal dependencies in the rockspec.conf file.

It is also possible to perform a complete bootstrap of the master development branch, although this branch is unstable, and sometimes breaks subtly, or does not build at all, or provides experimental new APIs that end up being removed prior to the next official release. Unfortunately, we don't have time to provide support for taking this most difficult and dangerous option. It is presumed that you already know enough to be aware of what you are getting yourself into - however, there are full logs of complete bootstrap builds in Travis after every commit, that you can examine if you get stuck. Also, the bootstrap script tries very hard to tell you why it is unhappy and, sometimes, even how to fix things before trying again.


The library is split into submodules according to the POSIX header file API declarations, which you can require individually:

    local unistd = require "posix.unistd"

The authoritative online POSIX reference is published at SUSv3.


The latest release of this library is documented in LDoc. Pre-built HTML files are included in the release, and contain links to the appropriate SUSv3 manual pages.

Example code

See the example program tree.lua, along with the many small examples in the generated documentation and BDD specs/*_spec.yaml.

For a complete application, see the GNU Zile.

Bugs reports and code contributions

These libraries are maintained by their users.

Please make bug reports and suggestions as GitHub issues. Pull requests are especially appreciated.

But first, please check that you issue has not already been reported by someone else, and that it is not already fixed by master in preparation for the next release (See Installation section above for how to temporarily install master with LuaRocks).

There is no strict coding style, but please bear in mind the following points when proposing changes:

  1. Follow existing code. There are a lot of useful patterns and avoided traps there.

  2. 8-character indentation using TABs in C sources; 2-character indentation using SPACEs in Lua sources.

  3. No non-POSIX APIs; no platform-specific code. When wrapping APIs introduced in POSIX 2001 or later, add an appropriate #if. If your platform isn't quite POSIX, you may find a gnulib module to bridge the gap. If absolutely necessary, use autoconf feature tests.

  4. Thin wrappers: although some existing code contradicts this, wrap POSIX APIs in the simplest way possible. If necessary, more convenient wrappers can be added in Lua (posix.lua).

Something went wrong with that request. Please try again.