Unified · Split
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | This is Lua 5.2.2, released on 22 Feb 2013. | 2 | This is Lua 5.2.2, released on 7 Mar 2013. |
| 3 | 3 | ||
| 4 | For installation instructions, license details, and | 4 | For installation instructions, license details, and |
| 5 | further information about Lua, see doc/readme.html. | 5 | further information about Lua, see doc/readme.html. |
| @@ -33,7 +33,7 @@ Freely available under the terms of the · 32 unmodified lines | |||
| 33 | <!-- ====================================================================== --> | 33 | <!-- ====================================================================== --> |
| 34 | <p> | 34 | <p> |
| 35 | 35 | ||
| 36 | <!-- $Id: manual.of,v 1.101 2013/02/15 12:33:36 roberto Exp $ --> | 36 | <!-- $Id: manual.of,v 1.102 2013/03/07 18:25:28 roberto Exp $ --> |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -8412,10 +8412,17 @@ Note that the resulting table may not be a sequence. · 8372 unmodified lines | |||
| 8412 | 8412 | ||
| 8413 | <p> | 8413 | <p> |
| 8414 | Removes from <code>list</code> the element at position <code>pos</code>, | 8414 | Removes from <code>list</code> the element at position <code>pos</code>, |
| 8415 | shifting down the elements | 8415 | returning the value of the removed element. |
| 8416 | When <code>pos</code> is an integer between 1 and <code>#list</code>, | ||
| 8417 | it shifts down the elements | ||
| 8416 | <code>list[pos+1], list[pos+2], ···, list[#list]</code> | 8418 | <code>list[pos+1], list[pos+2], ···, list[#list]</code> |
| 8417 | and erasing element <code>list[#list]</code>. | 8419 | and erases element <code>list[#list]</code>; |
| 8418 | Returns the value of the removed element. | 8420 | The index <code>pos</code> can also be 0, when <code>#list</code> is 0, |
| 8421 | or <code>#list + 1</code>; | ||
| 8422 | in those cases, the function erases the element <code>list[pos]</code>. | ||
| 8423 | |||
| 8424 | |||
| 8425 | <p> | ||
| 8419 | The default value for <code>pos</code> is <code>#list</code>, | 8426 | The default value for <code>pos</code> is <code>#list</code>, |
| 8420 | so that a call <code>table.remove(t)</code> removes the last element | 8427 | so that a call <code>table.remove(t)</code> removes the last element |
| 8421 | of list <code>t</code>. | 8428 | of list <code>t</code>. |
| @@ -10490,7 +10497,7 @@ Here is the complete syntax of Lua in extended BNF. · 2068 unmodified lines | |||
| 10490 | <HR> | 10497 | <HR> |
| 10491 | <SMALL CLASS="footer"> | 10498 | <SMALL CLASS="footer"> |
| 10492 | Last update: | 10499 | Last update: |
| 10493 | Tue Feb 19 16:28:19 BRT 2013 | 10500 | Thu Mar 7 15:36:34 BRT 2013 |
| 10494 | </SMALL> | 10501 | </SMALL> |
| 10495 | <!-- | 10502 | <!-- |
| 10496 | Last change: revised for Lua 5.2.2 | 10503 | Last change: revised for Lua 5.2.2 |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmathlib.c,v 1.82 2013/01/29 16:00:40 roberto Exp $ | 2 | ** $Id: lmathlib.c,v 1.83 2013/03/07 18:21:32 roberto Exp $ |
| 3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -160,7 +160,7 @@ static int math_frexp (lua_State *L) { · 154 unmodified lines | |||
| 160 | 160 | ||
| 161 | static int math_ldexp (lua_State *L) { | 161 | static int math_ldexp (lua_State *L) { |
| 162 | lua_Number x = luaL_checknumber(L, 1); | 162 | lua_Number x = luaL_checknumber(L, 1); |
| 163 | lua_Number ep = luaL_checknumber(L, 2); | 163 | int ep = luaL_checkint(L, 2); |
| 164 | lua_pushnumber(L, l_mathop(ldexp)(x, ep)); | 164 | lua_pushnumber(L, l_mathop(ldexp)(x, ep)); |
| 165 | return 1; | 165 | return 1; |
| 166 | } | 166 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltablib.c,v 1.64 2013/02/06 18:29:03 roberto Exp $ | 2 | ** $Id: ltablib.c,v 1.65 2013/03/07 18:17:24 roberto Exp $ |
| 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) { · 64 unmodified lines | |||
| 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); |