Skip to content

Commit 697d03b

Browse files
authored
Add note that xpcall's error handler preserves the trace (#944)
## Changes Adds a note that xpcall's error handler preserves the stack of the erroring function. This is useful to know if people are building error handlers and need to know the traceback. ## Checks By submitting your pull request for review, you agree to the following: - [x] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [x] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [x] To the best of my knowledge, all proposed changes are accurate. ---------
1 parent 18eef33 commit 697d03b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

content/en-us/reference/engine/globals/LuaGlobals.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,10 @@ functions:
756756
succeeds without errors. In this case, `xpcall()` also returns all results
757757
from the call, after this first result. In case of any error, `xpcall()`
758758
returns false plus the result from `err`.
759+
760+
Unlike `Global.LuaGlobals.pcall()`, the `err` function preserves the stack
761+
trace of function `f`, which can be inspected using `Library.debug.info()`
762+
or `Library.debug.traceback()`.
759763
parameters:
760764
- name: f
761765
type: function

0 commit comments

Comments
 (0)