Skip to content

Commit 94d020e

Browse files
committed
docs: link lua 5.5 manual section 8.1 from error wrapping comments
1 parent 7697025 commit 94d020e

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/lualib/ErrorObject.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// protected calls through `xpcall` with a message handler that wraps nil into
55
// this sentinel table (Lua 5.5 only mangles nil, not other values), and unwrap
66
// on the catch side.
7+
// See: https://www.lua.org/manual/5.5/manual.html#8.1
78
const ____TS__NilErrorObject: any = {};
89

910
export function __TS__WrapErrorObject(this: void, value: any): any {

src/transformation/visitors/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export const transformTryStatement: FunctionVisitor<ts.TryStatement> = (statemen
175175
// is replaced by a string when it propagates out of a protected call. To
176176
// preserve `throw undefined` semantics, route through xpcall with a message
177177
// handler that wraps nil into a sentinel, and unwrap before the user catch.
178+
// See: https://www.lua.org/manual/5.5/manual.html#8.1
178179
const wrapErrorObjects =
179180
context.options.luaTarget === LuaTarget.Lua55 || context.options.luaTarget === LuaTarget.Universal;
180181
if (wrapErrorObjects) {

0 commit comments

Comments
 (0)