diff options
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r-- | doc/lua_api.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index e017df880..ba6ff75f3 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -9956,3 +9956,17 @@ Bit Library Functions: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor, bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap See http://bitop.luajit.org/ for advanced information. + +Error Handling +-------------- + +When an error occurs that is not caught, Minetest calls the function +`minetest.error_handler` with the error object as its first argument. The second +argument is the stack level where the error occurred. The return value is the +error string that should be shown. By default this is a backtrace from +`debug.traceback`. If the error object is not a string, it is first converted +with `tostring` before being displayed. This means that you can use tables as +error objects so long as you give them `__tostring` metamethods. + +You can override `minetest.error_handler`. You should call the previous handler +with the correct stack level in your implementation. |