diff options
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.297 2014/09/22 06:42:15 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.298 2014/09/30 13:53:26 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -87,11 +87,11 @@ static int luaB_tonumber (lua_State *L) { | |||
87 | size_t l; | 87 | size_t l; |
88 | const char *s; | 88 | const char *s; |
89 | lua_Integer n = 0; /* to avoid warnings */ | 89 | lua_Integer n = 0; /* to avoid warnings */ |
90 | int base = luaL_checkint(L, 2); | 90 | lua_Integer base = luaL_checkinteger(L, 2); |
91 | luaL_checktype(L, 1, LUA_TSTRING); /* before 'luaL_checklstring'! */ | 91 | luaL_checktype(L, 1, LUA_TSTRING); /* before 'luaL_checklstring'! */ |
92 | s = luaL_checklstring(L, 1, &l); | 92 | s = luaL_checklstring(L, 1, &l); |
93 | luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); | 93 | luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); |
94 | if (b_str2int(s, base, &n) == s + l) { | 94 | if (b_str2int(s, (int)base, &n) == s + l) { |
95 | lua_pushinteger(L, n); | 95 | lua_pushinteger(L, n); |
96 | return 1; | 96 | return 1; |
97 | } /* else not a number */ | 97 | } /* else not a number */ |
@@ -102,7 +102,7 @@ static int luaB_tonumber (lua_State *L) { | |||
102 | 102 | ||
103 | 103 | ||
104 | static int luaB_error (lua_State *L) { | 104 | static int luaB_error (lua_State *L) { |
105 | int level = luaL_optint(L, 2, 1); | 105 | int level = (int)luaL_optinteger(L, 2, 1); |
106 | lua_settop(L, 1); | 106 | lua_settop(L, 1); |
107 | if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ | 107 | if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ |
108 | luaL_where(L, level); | 108 | luaL_where(L, level); |
@@ -180,7 +180,7 @@ static int luaB_collectgarbage (lua_State *L) { | |||
180 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, | 180 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, |
181 | LUA_GCISRUNNING}; | 181 | LUA_GCISRUNNING}; |
182 | int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; | 182 | int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; |
183 | int ex = luaL_optint(L, 2, 0); | 183 | int ex = (int)luaL_optinteger(L, 2, 0); |
184 | int res = lua_gc(L, o, ex); | 184 | int res = lua_gc(L, o, ex); |
185 | switch (o) { | 185 | switch (o) { |
186 | case LUA_GCCOUNT: { | 186 | case LUA_GCCOUNT: { |
@@ -248,7 +248,7 @@ static int luaB_pairs (lua_State *L) { | |||
248 | ** Traversal function for 'ipairs' for raw tables | 248 | ** Traversal function for 'ipairs' for raw tables |
249 | */ | 249 | */ |
250 | static int ipairsaux_raw (lua_State *L) { | 250 | static int ipairsaux_raw (lua_State *L) { |
251 | int i = luaL_checkint(L, 2) + 1; | 251 | lua_Integer i = luaL_checkinteger(L, 2) + 1; |
252 | luaL_checktype(L, 1, LUA_TTABLE); | 252 | luaL_checktype(L, 1, LUA_TTABLE); |
253 | lua_pushinteger(L, i); | 253 | lua_pushinteger(L, i); |
254 | return (lua_rawgeti(L, 1, i) == LUA_TNIL) ? 1 : 2; | 254 | return (lua_rawgeti(L, 1, i) == LUA_TNIL) ? 1 : 2; |
@@ -259,7 +259,7 @@ static int ipairsaux_raw (lua_State *L) { | |||
259 | ** Traversal function for 'ipairs' for tables with metamethods | 259 | ** Traversal function for 'ipairs' for tables with metamethods |
260 | */ | 260 | */ |
261 | static int ipairsaux (lua_State *L) { | 261 | static int ipairsaux (lua_State *L) { |
262 | int i = luaL_checkint(L, 2) + 1; | 262 | lua_Integer i = luaL_checkinteger(L, 2) + 1; |
263 | lua_pushinteger(L, i); | 263 | lua_pushinteger(L, i); |
264 | return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; | 264 | return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; |
265 | } | 265 | } |
@@ -405,11 +405,11 @@ static int luaB_select (lua_State *L) { | |||
405 | return 1; | 405 | return 1; |
406 | } | 406 | } |
407 | else { | 407 | else { |
408 | int i = luaL_checkint(L, 1); | 408 | lua_Integer i = luaL_checkinteger(L, 1); |
409 | if (i < 0) i = n + i; | 409 | if (i < 0) i = n + i; |
410 | else if (i > n) i = n; | 410 | else if (i > n) i = n; |
411 | luaL_argcheck(L, 1 <= i, 1, "index out of range"); | 411 | luaL_argcheck(L, 1 <= i, 1, "index out of range"); |
412 | return n - i; | 412 | return n - (int)i; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | 415 | ||