Reports errors with "?:?:" (instead of "?👎") when there is no debug
information.
This commit is contained in:
Roberto Ierusalimschy
2025-05-16 15:20:32 -03:00
parent ded2ad2d86
commit f2c1531e6c
2 changed files with 7 additions and 8 deletions

View File

@@ -817,16 +817,15 @@ l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
/* add src:line information to 'msg' */
const char *luaG_addinfo (lua_State *L, const char *msg, TString *src,
int line) {
char buff[LUA_IDSIZE];
if (src) {
if (src == NULL) /* no debug information? */
return luaO_pushfstring(L, "?:?: %s", msg);
else {
char buff[LUA_IDSIZE];
size_t idlen;
const char *id = getlstr(src, idlen);
luaO_chunkid(buff, id, idlen);
return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
}
else { /* no source available; use "?" instead */
buff[0] = '?'; buff[1] = '\0';
}
return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
}