diff options
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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); |