From 9294a2787f99174473afefcc0fcaf4f865959c63 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 17 Aug 1994 19:34:20 -0300 Subject: nova funcao 'debug', para auxiliar debugacao de programas lua. --- iolib.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'iolib.c') diff --git a/iolib.c b/iolib.c index d67ce9d6..a2321723 100644 --- a/iolib.c +++ b/iolib.c @@ -3,7 +3,7 @@ ** Input/output library to LUA */ -char *rcs_iolib="$Id: iolib.c,v 1.6 1994/08/11 23:11:57 celes Exp celes $"; +char *rcs_iolib="$Id: iolib.c,v 1.7 1994/08/17 15:10:04 celes Exp roberto $"; #include #include @@ -510,6 +510,21 @@ static void io_abort (void) exit(1); } +/* +** To debug a lua program. Start a dialog with the user, interpreting + lua commands until an 'cont'. +*/ +static void io_debug (void) +{ + while (1) + { + char buffer[250]; + printf("lua_debug> "); + if (gets(buffer) == 0) return; + if (strcmp(buffer, "cont") == 0) return; + lua_dostring(buffer); + } +} /* ** Open io library @@ -525,4 +540,5 @@ void iolib_open (void) lua_register ("remove", io_remove); lua_register ("getenv", io_getenv); lua_register ("abort", io_abort); + lua_register ("debug", io_debug); } -- cgit v1.2.3-55-g6feb