Lua 5.1 Package Compatibility for Lua 5.0


The Package Compatibility (Compat-5.1) is a set of files which provides an implementation of the Lua 5.1 package model to be used with Lua 5.0. It can be used by developers of Lua and Lua/C packages as much as by users that want to use those packages.

Compat-5.1 is free software and uses the same license as Lua 5.0.


Current version is compat-5.1 release 5 (following Lua 5.1). It was developed for Lua 5.0.


Compat-5.1 can be downloaded from its LuaForge page. There you can also find the previous versions of Compat-5.1.


Release 5 [02/Mar/2006]
Release 5 follows the implementation of Lua 5.1 beta and final, and corrects some implementation bugs found on Release 4:
  • swap the order of C and Lua loaders from "preload", "C", "Lua" to "preload", "Lua", "C"
  • added the package.seeall function
Release 4 [08/Jul/2005]
Release 4 follows the implementation of Lua 5.1 work 6 and corrects some implementation bugs found on Release 3:
  • Field _M added to namespace created by function module, refering to the namespace itself.
  • Internal lookup on tables (function getfield) uses rawget instead of normal indexing.
  • Lua-C stack cleanup in function luaL_module/luaL_openlib.
  • The Lua file was adapted by Tomás Guisasola to work with the VEnv library.
Release 3 [20/May/2005]
Release 3 follows the implementation of Lua 5.1 work 6. The release 3 differences are relative to the implementation:
  • Tables package and package.loaded are linked to functions require() and module() so that there is no way to change these tables per se, only its fields.
  • Function require() uses a list of loaders which are functions responsible for trying to load a module. Table package.loaders store these functions.
  • In Lua 5.0 all C functions share the same environment (which is obtained with the call getfenv(0) in Lua), while in 5.1w6, each C function has its own environment, which is the perfect place to store data. This way, C-upvalues became useless (they could be stored in the environment) and are deprecated.
Release 2 [23/Dec/2004]
Compat-5.1 release 2 fixes some bugs and misconceptions. It was based on the implementation of Lua 5.1 work 3.
Release 1 [29/Oct/2004]


Compat-5.1 was designed and implemented by Roberto Ierusalimschy. The pair of C source and header files were coded by Diego Nehab.

Release 5 was completely reimplemented by Tomás Guisasola, according to the changes added to the package model of Lua 5.1.

Compat-5.1 is distributed and maintained by the Kepler Project which holds its copyright.

Contact us

For more information please contact us. Comments are welcome!

You can also reach other Kepler developers and users on the Kepler Project mailing list

Valid XHTML 1.0!

$Id: index.php,v 1.35 2006/03/02 18:39:41 carregal Exp $