mirror of
https://github.com/lua/lua
synced 2024-11-25 06:09:36 +03:00
nova funcao 'debug', para auxiliar debugacao de programas lua.
This commit is contained in:
parent
0ec3a21451
commit
9294a2787f
18
iolib.c
18
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 <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user