LUA_ATPANIC(3) Library Functions Manual LUA_ATPANIC(3)

lua_atpanicsets a new panic function and returns the old one, function indicator [-0, +0, -]

#include <lua.h>

lua_CFunction
lua_atpanic(lua_State *L, lua_CFunction panicf);

() sets a new panic function and returns the old one.

If an error happens outside any protected environment, Lua calls a panic function and then calls , thus exiting the host application. Your panic function can avoid this exit by never returning (e.g., doing a long jump).

The panic function can access the error message at the top of the stack.

Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.

The lua_atpanic() manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.

July 14, 2022 Debian