diff options
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.18 2000/08/09 19:16:57 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.19 2000/08/28 17:57:04 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 | */ |
@@ -18,18 +18,16 @@ | |||
18 | 18 | ||
19 | 19 | ||
20 | static void settabss (lua_State *L, const char *i, const char *v) { | 20 | static void settabss (lua_State *L, const char *i, const char *v) { |
21 | lua_pushobject(L, -1); | ||
22 | lua_pushstring(L, i); | 21 | lua_pushstring(L, i); |
23 | lua_pushstring(L, v); | 22 | lua_pushstring(L, v); |
24 | lua_settable(L); | 23 | lua_settable(L, -3); |
25 | } | 24 | } |
26 | 25 | ||
27 | 26 | ||
28 | static void settabsi (lua_State *L, const char *i, int v) { | 27 | static void settabsi (lua_State *L, const char *i, int v) { |
29 | lua_pushobject(L, -1); | ||
30 | lua_pushstring(L, i); | 28 | lua_pushstring(L, i); |
31 | lua_pushnumber(L, v); | 29 | lua_pushnumber(L, v); |
32 | lua_settable(L); | 30 | lua_settable(L, -3); |
33 | } | 31 | } |
34 | 32 | ||
35 | 33 | ||
@@ -44,7 +42,7 @@ static int getinfo (lua_State *L) { | |||
44 | } | 42 | } |
45 | } | 43 | } |
46 | else if (lua_isfunction(L, 1)) { | 44 | else if (lua_isfunction(L, 1)) { |
47 | lua_pushobject(L, 1); | 45 | lua_pushvalue(L, 1); |
48 | sprintf(buff, ">%.10s", options); | 46 | sprintf(buff, ">%.10s", options); |
49 | options = buff; | 47 | options = buff; |
50 | } | 48 | } |
@@ -71,10 +69,9 @@ static int getinfo (lua_State *L) { | |||
71 | settabss(L, "namewhat", ar.namewhat); | 69 | settabss(L, "namewhat", ar.namewhat); |
72 | break; | 70 | break; |
73 | case 'f': | 71 | case 'f': |
74 | lua_pushobject(L, -1); | ||
75 | lua_pushstring(L, "func"); | 72 | lua_pushstring(L, "func"); |
76 | lua_pushobject(L, -4); | 73 | lua_pushvalue(L, -3); |
77 | lua_settable(L); | 74 | lua_settable(L, -3); |
78 | break; | 75 | break; |
79 | } | 76 | } |
80 | } | 77 | } |
@@ -90,7 +87,7 @@ static int getlocal (lua_State *L) { | |||
90 | name = lua_getlocal(L, &ar, luaL_check_int(L, 2)); | 87 | name = lua_getlocal(L, &ar, luaL_check_int(L, 2)); |
91 | if (name) { | 88 | if (name) { |
92 | lua_pushstring(L, name); | 89 | lua_pushstring(L, name); |
93 | lua_pushobject(L, -2); | 90 | lua_pushvalue(L, -2); |
94 | return 2; | 91 | return 2; |
95 | } | 92 | } |
96 | else { | 93 | else { |