diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-07 17:13:41 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-10-07 17:13:41 -0300 |
commit | f04fe526cd9de3e5460b614b2ff06268ad51872d (patch) | |
tree | 9e9fd4fc0bae4858d74c04a22d8ce5748191d5a9 /ltablib.c | |
parent | 21947deddc5976536665cd2397d7d5c9e6bd7e48 (diff) | |
download | lua-f04fe526cd9de3e5460b614b2ff06268ad51872d.tar.gz lua-f04fe526cd9de3e5460b614b2ff06268ad51872d.tar.bz2 lua-f04fe526cd9de3e5460b614b2ff06268ad51872d.zip |
new functions `lua_tointeger' and lua_pushinteger'
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.20 2003/03/11 12:24:34 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.21 2003/04/03 13:35: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 | */ |
@@ -24,7 +24,7 @@ static int luaB_foreachi (lua_State *L) { | |||
24 | luaL_checktype(L, 2, LUA_TFUNCTION); | 24 | luaL_checktype(L, 2, LUA_TFUNCTION); |
25 | for (i=1; i<=n; i++) { | 25 | for (i=1; i<=n; i++) { |
26 | lua_pushvalue(L, 2); /* function */ | 26 | lua_pushvalue(L, 2); /* function */ |
27 | lua_pushnumber(L, (lua_Number)i); /* 1st argument */ | 27 | lua_pushinteger(L, i); /* 1st argument */ |
28 | lua_rawgeti(L, 1, i); /* 2nd argument */ | 28 | lua_rawgeti(L, 1, i); /* 2nd argument */ |
29 | lua_call(L, 2, 1); | 29 | lua_call(L, 2, 1); |
30 | if (!lua_isnil(L, -1)) | 30 | if (!lua_isnil(L, -1)) |
@@ -54,7 +54,7 @@ static int luaB_foreach (lua_State *L) { | |||
54 | 54 | ||
55 | 55 | ||
56 | static int luaB_getn (lua_State *L) { | 56 | static int luaB_getn (lua_State *L) { |
57 | lua_pushnumber(L, (lua_Number)aux_getn(L, 1)); | 57 | lua_pushinteger(L, aux_getn(L, 1)); |
58 | return 1; | 58 | return 1; |
59 | } | 59 | } |
60 | 60 | ||