diff options
-rw-r--r-- | ltablib.c | 9 | ||||
-rw-r--r-- | luaconf.h | 13 |
2 files changed, 16 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.47 2009/06/17 17:53:50 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.48 2009/11/24 12:05:44 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -63,6 +63,7 @@ static int foreach (lua_State *L) { | |||
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | #if defined(LUA_COMPAT_MAXN) | ||
66 | static int maxn (lua_State *L) { | 67 | static int maxn (lua_State *L) { |
67 | lua_Number max = 0; | 68 | lua_Number max = 0; |
68 | luaL_checktype(L, 1, LUA_TTABLE); | 69 | luaL_checktype(L, 1, LUA_TTABLE); |
@@ -77,7 +78,11 @@ static int maxn (lua_State *L) { | |||
77 | lua_pushnumber(L, max); | 78 | lua_pushnumber(L, max); |
78 | return 1; | 79 | return 1; |
79 | } | 80 | } |
80 | 81 | #else | |
82 | static int maxn (lua_State *L) { | ||
83 | return luaL_error(L, "function 'maxn' is deprecated"); | ||
84 | } | ||
85 | #endif | ||
81 | 86 | ||
82 | static int getn (lua_State *L) { | 87 | static int getn (lua_State *L) { |
83 | lua_pushinteger(L, aux_getn(L, 1)); | 88 | lua_pushinteger(L, aux_getn(L, 1)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.117 2009/11/26 11:39:20 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.118 2009/11/26 16:49:28 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 | */ |
@@ -336,9 +336,8 @@ | |||
336 | 336 | ||
337 | /* | 337 | /* |
338 | @@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'. | 338 | @@ LUA_COMPAT_FENV controls the presence of functions 'setfenv/getfenv'. |
339 | ** CHANGE it (undefine it) if as soon as you rewrite your code to | 339 | ** CHANGE it (define it) if you need these functions. (You can replace |
340 | ** avoid using those functions. (You can replace them with lexical | 340 | ** them with lexical environments, 'loadin', or the debug library.) |
341 | ** environments, 'loadin', or the debug library.) | ||
342 | */ | 341 | */ |
343 | /* #define LUA_COMPAT_FENV */ | 342 | /* #define LUA_COMPAT_FENV */ |
344 | 343 | ||
@@ -350,6 +349,12 @@ | |||
350 | #define LUA_COMPAT_LOG10 | 349 | #define LUA_COMPAT_LOG10 |
351 | 350 | ||
352 | /* | 351 | /* |
352 | @@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. | ||
353 | ** CHANGE it (define it) if you need that function. | ||
354 | */ | ||
355 | /* #define LUA_COMPAT_MAXN */ | ||
356 | |||
357 | /* | ||
353 | @@ LUA_COMPAT_API includes some macros and functions that supply some | 358 | @@ LUA_COMPAT_API includes some macros and functions that supply some |
354 | @* compatibility with previous versions. | 359 | @* compatibility with previous versions. |
355 | ** CHANGE it (undefine it) if you do not need these compatibility facilities. | 360 | ** CHANGE it (undefine it) if you do not need these compatibility facilities. |