aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-01-25 13:52:52 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-01-25 13:52:52 -0300
commit108e0bdc8495782544c351b17eaae1411a910e89 (patch)
tree1196b9d9288b38b0be0290e30ec818fa09d06238 /lauxlib.c
parentb34a97a4af5c9e973915c07dba918d95009e0acd (diff)
parente288c5a91883793d14ed9e9d93464f6ee0b08915 (diff)
downloadlua-108e0bdc8495782544c351b17eaae1411a910e89.tar.gz
lua-108e0bdc8495782544c351b17eaae1411a910e89.tar.bz2
lua-108e0bdc8495782544c351b17eaae1411a910e89.zip
Merge branch 'master' into nextversion
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 8d23bc7d..f48060ed 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1043,9 +1043,14 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
1043} 1043}
1044 1044
1045 1045
1046/*
1047** Standard panic funcion just prints an error message. The test
1048** with 'lua_type' avoids possible memory errors in 'lua_tostring'.
1049*/
1046static int panic (lua_State *L) { 1050static int panic (lua_State *L) {
1047 const char *msg = lua_tostring(L, -1); 1051 const char *msg = (lua_type(L, -1) == LUA_TSTRING)
1048 if (msg == NULL) msg = "error object is not a string"; 1052 ? lua_tostring(L, -1)
1053 : "error object is not a string";
1049 lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", 1054 lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
1050 msg); 1055 msg);
1051 return 0; /* return to Lua to abort */ 1056 return 0; /* return to Lua to abort */