mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-16 18:01:40 +00:00
Use a Lua error handler that calls tostring (#11913)
This commit is contained in:
parent
1f3b5e553b
commit
0fc97a1483
5 changed files with 45 additions and 9 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue