diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-20 17:39:44 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-20 17:39:44 -0300 |
| commit | e572dffa1520f0331a0842a069bb17e2730c6575 (patch) | |
| tree | 86ed7b8d35f5b52dc78c39c847d060af0c7ff50d | |
| parent | 5893fcb71a81fe1e7857cab6938904de9f91830b (diff) | |
| download | lua-e572dffa1520f0331a0842a069bb17e2730c6575.tar.gz lua-e572dffa1520f0331a0842a069bb17e2730c6575.tar.bz2 lua-e572dffa1520f0331a0842a069bb17e2730c6575.zip | |
small bug building error messages
| -rw-r--r-- | ldebug.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.120 2002/06/18 15:19:27 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.121 2002/06/18 17:10:43 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -517,8 +517,9 @@ void luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) { | |||
| 517 | 517 | ||
| 518 | 518 | ||
| 519 | static void addinfo (lua_State *L, int internal) { | 519 | static void addinfo (lua_State *L, int internal) { |
| 520 | CallInfo *ci = (internal) ? L->ci : L->ci - 1; | ||
| 521 | const char *msg = svalue(L->top - 1); | 520 | const char *msg = svalue(L->top - 1); |
| 521 | CallInfo *ci = L->ci; | ||
| 522 | if (!internal && ci > L->base_ci) ci--; | ||
| 522 | if (strchr(msg, '\n')) return; /* message already `formatted' */ | 523 | if (strchr(msg, '\n')) return; /* message already `formatted' */ |
| 523 | if (!isLmark(ci)) { /* no Lua code? */ | 524 | if (!isLmark(ci)) { /* no Lua code? */ |
| 524 | luaO_pushfstring(L, "%s\n", msg); /* no extra info */ | 525 | luaO_pushfstring(L, "%s\n", msg); /* no extra info */ |
| @@ -543,6 +544,9 @@ void luaG_errormsg (lua_State *L, int internal) { | |||
| 543 | L->top += 2; | 544 | L->top += 2; |
| 544 | luaD_call(L, L->top - 2, 1); /* call error function? */ | 545 | luaD_call(L, L->top - 2, 1); /* call error function? */ |
| 545 | } | 546 | } |
| 547 | else { | ||
| 548 | setnilvalue(L->top++); | ||
| 549 | } | ||
| 546 | luaD_throw(L, LUA_ERRRUN); | 550 | luaD_throw(L, LUA_ERRRUN); |
| 547 | } | 551 | } |
| 548 | 552 | ||
