'int' -> 'lua_Integer' in several functions

This commit is contained in:
Roberto Ierusalimschy 2014-04-04 13:38:11 -03:00
parent 8b45d9806a
commit 9737832641
1 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: ltablib.c,v 1.66 2014/03/21 13:52:33 roberto Exp roberto $
** $Id: ltablib.c,v 1.67 2014/04/01 18:50:34 roberto Exp roberto $
** Library for Table Manipulation
** See Copyright Notice in lua.h
*/
@ -40,16 +40,16 @@ static int maxn (lua_State *L) {
static int tinsert (lua_State *L) {
int e = aux_getn(L, 1) + 1; /* first empty element */
int pos; /* where to insert new element */
lua_Integer e = aux_getn(L, 1) + 1; /* first empty element */
lua_Integer pos; /* where to insert new element */
switch (lua_gettop(L)) {
case 2: { /* called with only 2 arguments */
pos = e; /* insert new element at the end */
break;
}
case 3: {
int i;
pos = luaL_checkint(L, 2); /* 2nd argument is the position */
lua_Integer i;
pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */
luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds");
for (i = e; i > pos; i--) { /* move up elements */
lua_rawgeti(L, 1, i-1);
@ -67,8 +67,8 @@ static int tinsert (lua_State *L) {
static int tremove (lua_State *L) {
int size = aux_getn(L, 1);
int pos = luaL_optint(L, 2, size);
lua_Integer size = aux_getn(L, 1);
lua_Integer pos = luaL_optinteger(L, 2, size);
if (pos != size) /* validate 'pos' if given */
luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
lua_rawgeti(L, 1, pos); /* result = t[pos] */
@ -82,7 +82,7 @@ static int tremove (lua_State *L) {
}
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) {
lua_rawgeti(L, 1, i);
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
@ -94,11 +94,11 @@ static void addfield (lua_State *L, luaL_Buffer *b, int i) {
static int tconcat (lua_State *L) {
luaL_Buffer b;
size_t lsep;
int i, last;
lua_Integer i, last;
const char *sep = luaL_optlstring(L, 2, "", &lsep);
luaL_checktype(L, 1, LUA_TTABLE);
i = luaL_optint(L, 3, 1);
last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1));
i = luaL_optinteger(L, 3, 1);
last = luaL_opt(L, luaL_checkinteger, 4, luaL_len(L, 1));
luaL_buffinit(L, &b);
for (; i < last; i++) {
addfield(L, &b, i);