aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.h8
-rw-r--r--ldo.c4
-rw-r--r--loadlib.c10
-rw-r--r--luaconf.h31
4 files changed, 43 insertions, 10 deletions
diff --git a/lauxlib.h b/lauxlib.h
index 396ebdcc..bbd96345 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.73 2004/10/18 12:51:44 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.74 2005/01/10 17:31:50 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -15,6 +15,12 @@
15#include "lua.h" 15#include "lua.h"
16 16
17 17
18#if !LUA_COMPAT_GETN
19#define luaL_getn(L,i) lua_objsize(L, i)
20#define luaL_setn(L,i,j) ((void)0) /* no op! */
21#endif
22
23
18/* extra error code for `luaL_load' */ 24/* extra error code for `luaL_load' */
19#define LUA_ERRFILE (LUA_ERRERR+1) 25#define LUA_ERRFILE (LUA_ERRERR+1)
20 26
diff --git a/ldo.c b/ldo.c
index 23c0d7a3..9c7187eb 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.19 2005/03/18 18:55:09 roberto Exp roberto $ 2** $Id: ldo.c,v 2.20 2005/03/28 17:17:53 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -197,6 +197,7 @@ static StkId adjust_varargs (lua_State *L, int nfixargs, int actual,
197 for (; actual < nfixargs; ++actual) 197 for (; actual < nfixargs; ++actual)
198 setnilvalue(L->top++); 198 setnilvalue(L->top++);
199 } 199 }
200#if LUA_COMPAT_VARARG
200 if (style != NEWSTYLEVARARG) { /* compatibility with old-style vararg */ 201 if (style != NEWSTYLEVARARG) { /* compatibility with old-style vararg */
201 int nvar = actual - nfixargs; /* number of extra arguments */ 202 int nvar = actual - nfixargs; /* number of extra arguments */
202 luaC_checkGC(L); 203 luaC_checkGC(L);
@@ -207,6 +208,7 @@ static StkId adjust_varargs (lua_State *L, int nfixargs, int actual,
207 setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), 208 setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")),
208 cast(lua_Number, nvar)); 209 cast(lua_Number, nvar));
209 } 210 }
211#endif
210 /* move fixed parameters to final position */ 212 /* move fixed parameters to final position */
211 fixed = L->top - actual; /* first fixed argument */ 213 fixed = L->top - actual; /* first fixed argument */
212 base = L->top; /* final position of first argument */ 214 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 @@
1/* 1/*
2** $Id: loadlib.c,v 1.22 2005/03/18 16:38:43 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.23 2005/03/29 14:30:16 roberto Exp roberto $
3** Dynamic library loader for Lua 3** Dynamic library loader for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5** 5**
@@ -315,11 +315,13 @@ static int ll_loadlib (lua_State *L) {
315static int loader_Lua (lua_State *L) { 315static int loader_Lua (lua_State *L) {
316 const char *name = luaL_checkstring(L, 1); 316 const char *name = luaL_checkstring(L, 1);
317 const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); 317 const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP);
318 const char *path; 318 const char *path = NULL;
319#if LUA_COMPAT_PATH
319 /* try first `LUA_PATH' for compatibility */ 320 /* try first `LUA_PATH' for compatibility */
320 lua_pushstring(L, "LUA_PATH"); 321 lua_pushstring(L, "LUA_PATH");
321 lua_rawget(L, LUA_GLOBALSINDEX); 322 lua_rawget(L, LUA_GLOBALSINDEX);
322 path = lua_tostring(L, -1); 323 path = lua_tostring(L, -1);
324#endif
323 if (!path) { 325 if (!path) {
324 lua_pop(L, 1); 326 lua_pop(L, 1);
325 lua_getfield(L, LUA_ENVIRONINDEX, "path"); 327 lua_getfield(L, LUA_ENVIRONINDEX, "path");
@@ -505,8 +507,10 @@ LUALIB_API int luaopen_loadlib (lua_State *L) {
505 lua_setfield(L, -2, "preload"); 507 lua_setfield(L, -2, "preload");
506 /* create `loadlib' function */ 508 /* create `loadlib' function */
507 lua_pushcfunction(L, ll_loadlib); 509 lua_pushcfunction(L, ll_loadlib);
510#if LUA_COMPAT_LOADLIB
508 lua_pushvalue(L, -1); 511 lua_pushvalue(L, -1);
509 lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); /* COMPATIBILITY ONLY!! */ 512 lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
513#endif
510 lua_setfield(L, -2, "loadlib"); 514 lua_setfield(L, -2, "loadlib");
511 lua_pushvalue(L, LUA_GLOBALSINDEX); 515 lua_pushvalue(L, LUA_GLOBALSINDEX);
512 luaL_openlib(L, NULL, ll_funcs, 0); /* open lib into global table */ 516 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 @@
1/* 1/*
2** $Id: luaconf.h,v 1.38 2005/03/21 18:12:07 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.39 2005/03/29 14:30:16 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -229,11 +229,32 @@
229 229
230 230
231/* 231/*
232** CHANGE here (undefining both luaL_getn and luaL_setn) if you want 232@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
233** exact compatibility with the behavior of setn/getn in Lua 5.0. 233** CHANGE it to 1 if you want exact compatibility with the behavior of
234** setn/getn in Lua 5.0.
234*/ 235*/
235#define luaL_getn(L,i) lua_objsize(L, i) 236#define LUA_COMPAT_GETN 0
236#define luaL_setn(L,i,j) ((void)0) /* no op! */ 237
238/*
239@@ LUA_COMPAT_PATH controls compatibility about LUA_PATH.
240** CHANGE it to 1 if you want `require' to look for global LUA_PATH
241** before checking package.path.
242*/
243#define LUA_COMPAT_PATH 0
244
245/*
246@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
247** CHANGE it to 1 if you want a global `loadlib' function (otherwise
248** the function is only available as `package.loadlib').
249*/
250#define LUA_COMPAT_LOADLIB 1
251
252/*
253@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
254** CHANGE it to 1 if you want vararg functions that do not use `...'
255** to get an `arg' table with their extra arguments.
256*/
257#define LUA_COMPAT_VARARG 1
237 258
238 259
239/* 260/*