aboutsummaryrefslogtreecommitdiff
path: root/ltablib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-03-07 15:17:24 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-03-07 15:17:24 -0300
commit15a3738b4994cc8bbe23d73d640743338ae22b02 (patch)
treed8875c7d2a0a818ad2615b012bbe480cf5140094 /ltablib.c
parenta83ed55f1e3e20f73d01489c18889bb8554593ce (diff)
downloadlua-15a3738b4994cc8bbe23d73d640743338ae22b02.tar.gz
lua-15a3738b4994cc8bbe23d73d640743338ae22b02.tar.bz2
lua-15a3738b4994cc8bbe23d73d640743338ae22b02.zip
no need to handle 0 as a special case in 'table.remove'
Diffstat (limited to 'ltablib.c')
-rw-r--r--ltablib.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ltablib.c b/ltablib.c
index 07fc9aa4..50c506e3 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltablib.c,v 1.63 2011/11/28 17:26:30 roberto Exp roberto $ 2** $Id: ltablib.c,v 1.64 2013/02/06 18:29:03 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*/
@@ -70,8 +70,6 @@ static int tremove (lua_State *L) {
70 int pos = luaL_optint(L, 2, size); 70 int pos = luaL_optint(L, 2, size);
71 if (pos != size) /* validate 'pos' if given */ 71 if (pos != size) /* validate 'pos' if given */
72 luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); 72 luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
73 else if (size == 0) /* empty table? */
74 return 0; /* return nothing (nil) */
75 lua_rawgeti(L, 1, pos); /* result = t[pos] */ 73 lua_rawgeti(L, 1, pos); /* result = t[pos] */
76 for ( ; pos < size; pos++) { 74 for ( ; pos < size; pos++) {
77 lua_rawgeti(L, 1, pos+1); 75 lua_rawgeti(L, 1, pos+1);