From fc0de64c2c3b79c68decc786c1de974fa2a6686e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 9 Nov 1994 16:09:22 -0200 Subject: [PATCH] lua_debugline is kept in the stack 'funcstack' when debugging. --- inout.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/inout.c b/inout.c index 3e6b472b..9a54f4fc 100644 --- a/inout.c +++ b/inout.c @@ -5,7 +5,7 @@ ** Also provides some predefined lua functions. */ -char *rcs_inout="$Id: inout.c,v 2.8 1994/11/07 16:34:44 roberto Exp roberto $"; +char *rcs_inout="$Id: inout.c,v 2.9 1994/11/08 20:06:15 roberto Exp roberto $"; #include #include @@ -21,13 +21,17 @@ char *rcs_inout="$Id: inout.c,v 2.8 1994/11/07 16:34:44 roberto Exp roberto $"; /* Exported variables */ int lua_linenumber; int lua_debug; -int lua_debugline; +int lua_debugline = 0; /* Internal variables */ #ifndef MAXFUNCSTACK #define MAXFUNCSTACK 64 #endif -static struct { char *file; int function; } funcstack[MAXFUNCSTACK]; +static struct { + char *file; + int function; + int line; +} funcstack[MAXFUNCSTACK]; static int nfuncstack=0; static FILE *fp; @@ -117,6 +121,7 @@ int lua_pushfunction (char *file, int function) } funcstack[nfuncstack].function = function; funcstack[nfuncstack].file = file; + funcstack[nfuncstack].line= lua_debugline; nfuncstack++; return 0; } @@ -127,7 +132,8 @@ int lua_pushfunction (char *file, int function) */ void lua_popfunction (void) { - nfuncstack--; + --nfuncstack; + lua_debugline = funcstack[nfuncstack].line; } /* @@ -269,6 +275,6 @@ void luaI_error (void) { char *s = lua_getstring(lua_getparam(1)); if (s == NULL) s = "(no message)"; - lua_error(s); + lua_reportbug(s); }