diff --git a/lauxlib.h b/lauxlib.h
index 396ebdcc..bbd96345 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
 /*
-** $Id: lauxlib.h,v 1.73 2004/10/18 12:51:44 roberto Exp roberto $
+** $Id: lauxlib.h,v 1.74 2005/01/10 17:31:50 roberto Exp roberto $
 ** Auxiliary functions for building Lua libraries
 ** See Copyright Notice in lua.h
 */
@@ -15,6 +15,12 @@
 #include "lua.h"
 
 
+#if !LUA_COMPAT_GETN
+#define luaL_getn(L,i)          lua_objsize(L, i)
+#define luaL_setn(L,i,j)        ((void)0)  /* no op! */
+#endif
+
+
 /* extra error code for `luaL_load' */
 #define LUA_ERRFILE     (LUA_ERRERR+1)
 
diff --git a/ldo.c b/ldo.c
index 23c0d7a3..9c7187eb 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.c,v 2.19 2005/03/18 18:55:09 roberto Exp roberto $
+** $Id: ldo.c,v 2.20 2005/03/28 17:17:53 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -197,6 +197,7 @@ static StkId adjust_varargs (lua_State *L, int nfixargs, int actual,
     for (; actual < nfixargs; ++actual)
       setnilvalue(L->top++);
   }
+#if LUA_COMPAT_VARARG
   if (style != NEWSTYLEVARARG) {  /* compatibility with old-style vararg */
     int nvar = actual - nfixargs;  /* number of extra arguments */
     luaC_checkGC(L);
@@ -207,6 +208,7 @@ static StkId adjust_varargs (lua_State *L, int nfixargs, int actual,
     setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")),
                                    cast(lua_Number, nvar));
   }
+#endif
   /* move fixed parameters to final position */
   fixed = L->top - actual;  /* first fixed argument */
   base = L->top;  /* final position of first argument */
diff --git a/loadlib.c b/loadlib.c
index 1b8925c0..93bf0031 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
 /*
-** $Id: loadlib.c,v 1.22 2005/03/18 16:38:43 roberto Exp roberto $
+** $Id: loadlib.c,v 1.23 2005/03/29 14:30:16 roberto Exp roberto $
 ** Dynamic library loader for Lua
 ** See Copyright Notice in lua.h
 **
@@ -315,11 +315,13 @@ static int ll_loadlib (lua_State *L) {
 static int loader_Lua (lua_State *L) {
   const char *name = luaL_checkstring(L, 1);
   const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP);
-  const char *path;
+  const char *path = NULL;
+#if LUA_COMPAT_PATH
   /* try first `LUA_PATH' for compatibility */
   lua_pushstring(L, "LUA_PATH");
   lua_rawget(L, LUA_GLOBALSINDEX);
   path = lua_tostring(L, -1);
+#endif
   if (!path) {
     lua_pop(L, 1);
     lua_getfield(L, LUA_ENVIRONINDEX, "path");
@@ -505,8 +507,10 @@ LUALIB_API int luaopen_loadlib (lua_State *L) {
   lua_setfield(L, -2, "preload");
   /* create `loadlib' function */
   lua_pushcfunction(L, ll_loadlib);
+#if LUA_COMPAT_LOADLIB
   lua_pushvalue(L, -1);
-  lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");  /* COMPATIBILITY ONLY!! */
+  lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
+#endif
   lua_setfield(L, -2, "loadlib");
   lua_pushvalue(L, LUA_GLOBALSINDEX);
   luaL_openlib(L, NULL, ll_funcs, 0);  /* open lib into global table */
diff --git a/luaconf.h b/luaconf.h
index 2a9a22fc..9f86f962 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
 /*
-** $Id: luaconf.h,v 1.38 2005/03/21 18:12:07 roberto Exp roberto $
+** $Id: luaconf.h,v 1.39 2005/03/29 14:30:16 roberto Exp roberto $
 ** Configuration file for Lua
 ** See Copyright Notice in lua.h
 */
@@ -229,11 +229,32 @@
 
 
 /*
-** CHANGE here (undefining both luaL_getn and luaL_setn) if you want
-** exact compatibility with the behavior of setn/getn in Lua 5.0.
+@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
+** CHANGE it to 1 if you want exact compatibility with the behavior of
+** setn/getn in Lua 5.0.
 */
-#define luaL_getn(L,i)		lua_objsize(L, i)
-#define luaL_setn(L,i,j)	((void)0)  /* no op! */
+#define LUA_COMPAT_GETN		0
+
+/*
+@@ LUA_COMPAT_PATH controls compatibility about LUA_PATH.
+** CHANGE it to 1 if you want `require' to look for global LUA_PATH
+** before checking package.path.
+*/
+#define LUA_COMPAT_PATH		0
+
+/*
+@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
+** CHANGE it to 1 if you want a global `loadlib' function (otherwise
+** the function is only available as `package.loadlib').
+*/
+#define LUA_COMPAT_LOADLIB	1
+
+/*
+@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
+** CHANGE it to 1 if you want vararg functions that do not use `...'
+** to get an `arg' table with their extra arguments.
+*/
+#define LUA_COMPAT_VARARG	1
 
 
 /*