diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-04 13:38:11 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-04 13:38:11 -0300 |
commit | 97378326412b8e39ff2e0b839d5fad085dbc57ea (patch) | |
tree | 0123f7f1013ea6a2001de67a9646d7b1d363cbcc /ltablib.c | |
parent | 8b45d9806aec534d7b0b788da887c4b421c5395d (diff) | |
download | lua-97378326412b8e39ff2e0b839d5fad085dbc57ea.tar.gz lua-97378326412b8e39ff2e0b839d5fad085dbc57ea.tar.bz2 lua-97378326412b8e39ff2e0b839d5fad085dbc57ea.zip |
'int' -> 'lua_Integer' in several functions
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.66 2014/03/21 13:52:33 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.67 2014/04/01 18:50:34 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 | */ |
@@ -40,16 +40,16 @@ static int maxn (lua_State *L) { | |||
40 | 40 | ||
41 | 41 | ||
42 | static int tinsert (lua_State *L) { | 42 | static int tinsert (lua_State *L) { |
43 | int e = aux_getn(L, 1) + 1; /* first empty element */ | 43 | lua_Integer e = aux_getn(L, 1) + 1; /* first empty element */ |
44 | int pos; /* where to insert new element */ | 44 | lua_Integer pos; /* where to insert new element */ |
45 | switch (lua_gettop(L)) { | 45 | switch (lua_gettop(L)) { |
46 | case 2: { /* called with only 2 arguments */ | 46 | case 2: { /* called with only 2 arguments */ |
47 | pos = e; /* insert new element at the end */ | 47 | pos = e; /* insert new element at the end */ |
48 | break; | 48 | break; |
49 | } | 49 | } |
50 | case 3: { | 50 | case 3: { |
51 | int i; | 51 | lua_Integer i; |
52 | pos = luaL_checkint(L, 2); /* 2nd argument is the position */ | 52 | pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */ |
53 | luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); | 53 | luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); |
54 | for (i = e; i > pos; i--) { /* move up elements */ | 54 | for (i = e; i > pos; i--) { /* move up elements */ |
55 | lua_rawgeti(L, 1, i-1); | 55 | lua_rawgeti(L, 1, i-1); |
@@ -67,8 +67,8 @@ static int tinsert (lua_State *L) { | |||
67 | 67 | ||
68 | 68 | ||
69 | static int tremove (lua_State *L) { | 69 | static int tremove (lua_State *L) { |
70 | int size = aux_getn(L, 1); | 70 | lua_Integer size = aux_getn(L, 1); |
71 | int pos = luaL_optint(L, 2, size); | 71 | lua_Integer pos = luaL_optinteger(L, 2, size); |
72 | if (pos != size) /* validate 'pos' if given */ | 72 | if (pos != size) /* validate 'pos' if given */ |
73 | luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); | 73 | luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); |
74 | lua_rawgeti(L, 1, pos); /* result = t[pos] */ | 74 | lua_rawgeti(L, 1, pos); /* result = t[pos] */ |
@@ -82,7 +82,7 @@ static int tremove (lua_State *L) { | |||
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | static void addfield (lua_State *L, luaL_Buffer *b, int i) { | 85 | static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) { |
86 | lua_rawgeti(L, 1, i); | 86 | lua_rawgeti(L, 1, i); |
87 | if (!lua_isstring(L, -1)) | 87 | if (!lua_isstring(L, -1)) |
88 | luaL_error(L, "invalid value (%s) at index %d in table for " | 88 | 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) { | |||
94 | static int tconcat (lua_State *L) { | 94 | static int tconcat (lua_State *L) { |
95 | luaL_Buffer b; | 95 | luaL_Buffer b; |
96 | size_t lsep; | 96 | size_t lsep; |
97 | int i, last; | 97 | lua_Integer i, last; |
98 | const char *sep = luaL_optlstring(L, 2, "", &lsep); | 98 | const char *sep = luaL_optlstring(L, 2, "", &lsep); |
99 | luaL_checktype(L, 1, LUA_TTABLE); | 99 | luaL_checktype(L, 1, LUA_TTABLE); |
100 | i = luaL_optint(L, 3, 1); | 100 | i = luaL_optinteger(L, 3, 1); |
101 | last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1)); | 101 | last = luaL_opt(L, luaL_checkinteger, 4, luaL_len(L, 1)); |
102 | luaL_buffinit(L, &b); | 102 | luaL_buffinit(L, &b); |
103 | for (; i < last; i++) { | 103 | for (; i < last; i++) { |
104 | addfield(L, &b, i); | 104 | addfield(L, &b, i); |