diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/manual.html | 17 | ||||
-rw-r--r-- | src/lmathlib.c | 4 | ||||
-rw-r--r-- | src/ltablib.c | 4 |
4 files changed, 16 insertions, 11 deletions
@@ -1,5 +1,5 @@ -This is Lua 5.2.2, released on 22 Feb 2013. +This is Lua 5.2.2, released on 7 Mar 2013. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/doc/manual.html b/doc/manual.html index 80fdb10e..251d4dce 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -33,7 +33,7 @@ Freely available under the terms of the <!-- ====================================================================== --> <p> -<!-- $Id: manual.of,v 1.101 2013/02/15 12:33:36 roberto Exp $ --> +<!-- $Id: manual.of,v 1.102 2013/03/07 18:25:28 roberto Exp $ --> @@ -8412,10 +8412,17 @@ Note that the resulting table may not be a sequence. <p> Removes from <code>list</code> the element at position <code>pos</code>, -shifting down the elements +returning the value of the removed element. +When <code>pos</code> is an integer between 1 and <code>#list</code>, +it shifts down the elements <code>list[pos+1], list[pos+2], ···, list[#list]</code> -and erasing element <code>list[#list]</code>. -Returns the value of the removed element. +and erases element <code>list[#list]</code>; +The index <code>pos</code> can also be 0, when <code>#list</code> is 0, +or <code>#list + 1</code>; +in those cases, the function erases the element <code>list[pos]</code>. + + +<p> The default value for <code>pos</code> is <code>#list</code>, so that a call <code>table.remove(t)</code> removes the last element of list <code>t</code>. @@ -10490,7 +10497,7 @@ Here is the complete syntax of Lua in extended BNF. <HR> <SMALL CLASS="footer"> Last update: -Tue Feb 19 16:28:19 BRT 2013 +Thu Mar 7 15:36:34 BRT 2013 </SMALL> <!-- Last change: revised for Lua 5.2.2 diff --git a/src/lmathlib.c b/src/lmathlib.c index a703c33b..a49f1fd2 100644 --- a/src/lmathlib.c +++ b/src/lmathlib.c @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.82 2013/01/29 16:00:40 roberto Exp $ +** $Id: lmathlib.c,v 1.83 2013/03/07 18:21:32 roberto Exp $ ** Standard mathematical library ** See Copyright Notice in lua.h */ @@ -160,7 +160,7 @@ static int math_frexp (lua_State *L) { static int math_ldexp (lua_State *L) { lua_Number x = luaL_checknumber(L, 1); - lua_Number ep = luaL_checknumber(L, 2); + int ep = luaL_checkint(L, 2); lua_pushnumber(L, l_mathop(ldexp)(x, ep)); return 1; } diff --git a/src/ltablib.c b/src/ltablib.c index 41f5df80..ad798b4e 100644 --- a/src/ltablib.c +++ b/src/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.64 2013/02/06 18:29:03 roberto Exp $ +** $Id: ltablib.c,v 1.65 2013/03/07 18:17:24 roberto Exp $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -70,8 +70,6 @@ static int tremove (lua_State *L) { int pos = luaL_optint(L, 2, size); if (pos != size) /* validate 'pos' if given */ luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); - else if (size == 0) /* empty table? */ - return 0; /* return nothing (nil) */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ for ( ; pos < size; pos++) { lua_rawgeti(L, 1, pos+1); |