浏览代码

Corrected error message in 'table.remove'

Roberto Ierusalimschy 2 年之前
父节点
当前提交
cd56f222b7
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      ltablib.c

+ 1 - 1
ltablib.c

@@ -93,7 +93,7 @@ static int tremove (lua_State *L) {
   lua_Integer pos = luaL_optinteger(L, 2, size);
   lua_Integer pos = luaL_optinteger(L, 2, size);
   if (pos != size)  /* validate 'pos' if given */
   if (pos != size)  /* validate 'pos' if given */
     /* check whether 'pos' is in [1, size + 1] */
     /* check whether 'pos' is in [1, size + 1] */
-    luaL_argcheck(L, (lua_Unsigned)pos - 1u <= (lua_Unsigned)size, 1,
+    luaL_argcheck(L, (lua_Unsigned)pos - 1u <= (lua_Unsigned)size, 2,
                      "position out of bounds");
                      "position out of bounds");
   lua_geti(L, 1, pos);  /* result = t[pos] */
   lua_geti(L, 1, pos);  /* result = t[pos] */
   for ( ; pos < size; pos++) {
   for ( ; pos < size; pos++) {