diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-02-18 17:18:41 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-02-18 17:18:41 -0200 |
commit | 4274738e81ad12923c2ae5c769b3350c36cf1505 (patch) | |
tree | 995af0a432f0e6a7b2b42f085c8b7ee6f21b4804 /ldblib.c | |
parent | 0d7d559dcc4291c2df5106ec121a43239b1faa91 (diff) | |
download | lua-4274738e81ad12923c2ae5c769b3350c36cf1505.tar.gz lua-4274738e81ad12923c2ae5c769b3350c36cf1505.tar.bz2 lua-4274738e81ad12923c2ae5c769b3350c36cf1505.zip |
new macro 'luai_writestringerror'
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.118 2009/11/25 15:27:51 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.119 2010/01/06 14:42:35 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 | */ |
@@ -339,15 +339,13 @@ static int db_gethook (lua_State *L) { | |||
339 | static int db_debug (lua_State *L) { | 339 | static int db_debug (lua_State *L) { |
340 | for (;;) { | 340 | for (;;) { |
341 | char buffer[250]; | 341 | char buffer[250]; |
342 | fputs("lua_debug> ", stderr); | 342 | luai_writestringerror("%s", "lua_debug> "); |
343 | if (fgets(buffer, sizeof(buffer), stdin) == 0 || | 343 | if (fgets(buffer, sizeof(buffer), stdin) == 0 || |
344 | strcmp(buffer, "cont\n") == 0) | 344 | strcmp(buffer, "cont\n") == 0) |
345 | return 0; | 345 | return 0; |
346 | if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || | 346 | if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || |
347 | lua_pcall(L, 0, 0, 0)) { | 347 | lua_pcall(L, 0, 0, 0)) |
348 | fputs(lua_tostring(L, -1), stderr); | 348 | luai_writestringerror("%s\n", lua_tostring(L, -1)); |
349 | fputs("\n", stderr); | ||
350 | } | ||
351 | lua_settop(L, 0); /* remove eventual returns */ | 349 | lua_settop(L, 0); /* remove eventual returns */ |
352 | } | 350 | } |
353 | } | 351 | } |