aboutsummaryrefslogtreecommitdiff
path: root/ltablib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-11-26 15:35:13 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-11-26 15:35:13 -0200
commit93695db90382fc00b054e1db177985d6a8fa1609 (patch)
tree8df7c1c819d02cd5bc35e205c5d639a812e24406 /ltablib.c
parent9107dd115ce2ddf6cee2610daffaf7fb29133d9f (diff)
downloadlua-93695db90382fc00b054e1db177985d6a8fa1609.tar.gz
lua-93695db90382fc00b054e1db177985d6a8fa1609.tar.bz2
lua-93695db90382fc00b054e1db177985d6a8fa1609.zip
'table.maxn' deprecated
Diffstat (limited to 'ltablib.c')
-rw-r--r--ltablib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ltablib.c b/ltablib.c
index e2fe976d..cf846150 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -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)
66static int maxn (lua_State *L) { 67static 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
82static int maxn (lua_State *L) {
83 return luaL_error(L, "function 'maxn' is deprecated");
84}
85#endif
81 86
82static int getn (lua_State *L) { 87static int getn (lua_State *L) {
83 lua_pushinteger(L, aux_getn(L, 1)); 88 lua_pushinteger(L, aux_getn(L, 1));