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 /ldblib.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 'ldblib.c')
| -rw-r--r-- | ldblib.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.80 2003/04/03 13:35:34 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.81 2003/07/07 13:37:08 roberto Exp roberto $ |
| 3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -27,7 +27,7 @@ static void settabss (lua_State *L, const char *i, const char *v) { | |||
| 27 | 27 | ||
| 28 | static void settabsi (lua_State *L, const char *i, int v) { | 28 | static void settabsi (lua_State *L, const char *i, int v) { |
| 29 | lua_pushstring(L, i); | 29 | lua_pushstring(L, i); |
| 30 | lua_pushnumber(L, (lua_Number)v); | 30 | lua_pushinteger(L, v); |
| 31 | lua_rawset(L, -3); | 31 | lua_rawset(L, -3); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| @@ -50,7 +50,7 @@ static int getinfo (lua_State *L) { | |||
| 50 | lua_State *L1 = getthread(L, &arg); | 50 | lua_State *L1 = getthread(L, &arg); |
| 51 | const char *options = luaL_optstring(L, arg+2, "flnSu"); | 51 | const char *options = luaL_optstring(L, arg+2, "flnSu"); |
| 52 | if (lua_isnumber(L, arg+1)) { | 52 | if (lua_isnumber(L, arg+1)) { |
| 53 | if (!lua_getstack(L1, (int)(lua_tonumber(L, arg+1)), &ar)) { | 53 | if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { |
| 54 | lua_pushnil(L); /* level out of range */ | 54 | lua_pushnil(L); /* level out of range */ |
| 55 | return 1; | 55 | return 1; |
| 56 | } | 56 | } |
| @@ -171,7 +171,7 @@ static void hookf (lua_State *L, lua_Debug *ar) { | |||
| 171 | if (lua_isfunction(L, -1)) { | 171 | if (lua_isfunction(L, -1)) { |
| 172 | lua_pushstring(L, hooknames[(int)ar->event]); | 172 | lua_pushstring(L, hooknames[(int)ar->event]); |
| 173 | if (ar->currentline >= 0) | 173 | if (ar->currentline >= 0) |
| 174 | lua_pushnumber(L, (lua_Number)ar->currentline); | 174 | lua_pushinteger(L, ar->currentline); |
| 175 | else lua_pushnil(L); | 175 | else lua_pushnil(L); |
| 176 | lua_assert(lua_getinfo(L, "lS", ar)); | 176 | lua_assert(lua_getinfo(L, "lS", ar)); |
| 177 | lua_call(L, 2, 0); | 177 | lua_call(L, 2, 0); |
| @@ -251,7 +251,7 @@ static int gethook (lua_State *L) { | |||
| 251 | lua_xmove(L1, L, 1); | 251 | lua_xmove(L1, L, 1); |
| 252 | } | 252 | } |
| 253 | lua_pushstring(L, unmakemask(mask, buff)); | 253 | lua_pushstring(L, unmakemask(mask, buff)); |
| 254 | lua_pushnumber(L, (lua_Number)lua_gethookcount(L1)); | 254 | lua_pushinteger(L, lua_gethookcount(L1)); |
| 255 | return 3; | 255 | return 3; |
| 256 | } | 256 | } |
| 257 | 257 | ||
