aboutsummaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ldblib.c b/ldblib.c
index 106c1e02..8fe60179 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.49 2002/05/01 20:40:42 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.50 2002/05/06 19:05:10 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*/
@@ -34,7 +34,6 @@ static void settabsi (lua_State *L, const char *i, int v) {
34static int getinfo (lua_State *L) { 34static int getinfo (lua_State *L) {
35 lua_Debug ar; 35 lua_Debug ar;
36 const char *options = luaL_opt_string(L, 2, "flnSu"); 36 const char *options = luaL_opt_string(L, 2, "flnSu");
37 char buff[20];
38 if (lua_isnumber(L, 1)) { 37 if (lua_isnumber(L, 1)) {
39 if (!lua_getstack(L, (int)(lua_tonumber(L, 1)), &ar)) { 38 if (!lua_getstack(L, (int)(lua_tonumber(L, 1)), &ar)) {
40 lua_pushnil(L); /* level out of range */ 39 lua_pushnil(L); /* level out of range */
@@ -42,9 +41,9 @@ static int getinfo (lua_State *L) {
42 } 41 }
43 } 42 }
44 else if (lua_isfunction(L, 1)) { 43 else if (lua_isfunction(L, 1)) {
44 luaL_vstr(L, ">%s", options);
45 options = lua_tostring(L, -1);
45 lua_pushvalue(L, 1); 46 lua_pushvalue(L, 1);
46 sprintf(buff, ">%.10s", options);
47 options = buff;
48 } 47 }
49 else 48 else
50 return luaL_argerror(L, 1, "function or level expected"); 49 return luaL_argerror(L, 1, "function or level expected");
@@ -170,7 +169,7 @@ static int setlinehook (lua_State *L) {
170static int debug (lua_State *L) { 169static int debug (lua_State *L) {
171 for (;;) { 170 for (;;) {
172 char buffer[250]; 171 char buffer[250];
173 fprintf(stderr, "lua_debug> "); 172 fputs("lua_debug> ", stderr);
174 if (fgets(buffer, sizeof(buffer), stdin) == 0 || 173 if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
175 strcmp(buffer, "cont\n") == 0) 174 strcmp(buffer, "cont\n") == 0)
176 return 0; 175 return 0;