Merge branch 'master' into nextversion

This commit is contained in:
Roberto Ierusalimschy
2024-01-25 13:52:52 -03:00
8 changed files with 27 additions and 12 deletions

View File

@@ -1043,9 +1043,14 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
}
/*
** Standard panic funcion just prints an error message. The test
** with 'lua_type' avoids possible memory errors in 'lua_tostring'.
*/
static int panic (lua_State *L) {
const char *msg = lua_tostring(L, -1);
if (msg == NULL) msg = "error object is not a string";
const char *msg = (lua_type(L, -1) == LUA_TSTRING)
? lua_tostring(L, -1)
: "error object is not a string";
lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
msg);
return 0; /* return to Lua to abort */