From e572dffa1520f0331a0842a069bb17e2730c6575 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 20 Jun 2002 17:39:44 -0300 Subject: [PATCH] small bug building error messages --- ldebug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ldebug.c b/ldebug.c index 12b85bd1..2b7f566f 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.120 2002/06/18 15:19:27 roberto Exp roberto $ +** $Id: ldebug.c,v 1.121 2002/06/18 17:10:43 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -517,8 +517,9 @@ void luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) { static void addinfo (lua_State *L, int internal) { - CallInfo *ci = (internal) ? L->ci : L->ci - 1; const char *msg = svalue(L->top - 1); + CallInfo *ci = L->ci; + if (!internal && ci > L->base_ci) ci--; if (strchr(msg, '\n')) return; /* message already `formatted' */ if (!isLmark(ci)) { /* no Lua code? */ luaO_pushfstring(L, "%s\n", msg); /* no extra info */ @@ -543,6 +544,9 @@ void luaG_errormsg (lua_State *L, int internal) { L->top += 2; luaD_call(L, L->top - 2, 1); /* call error function? */ } + else { + setnilvalue(L->top++); + } luaD_throw(L, LUA_ERRRUN); }