isaacscript-common 1.0.519 → 1.0.520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/functions/array.lua
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local errorWithTraceback, slimTracebackOutput, vanillaError
|
|
4
|
+
local errorWithTraceback, slimTracebackOutput, removeAnyLineThatContains, LINE_SEPARATOR, USELESS_TRACEBACK_MESSAGES, vanillaError
|
|
5
5
|
local ____debug = require("functions.debug")
|
|
6
6
|
local getTraceback = ____debug.getTraceback
|
|
7
7
|
local ____util = require("functions.util")
|
|
@@ -19,17 +19,27 @@ function errorWithTraceback(message, level)
|
|
|
19
19
|
return vanillaError(message, level + 1)
|
|
20
20
|
end
|
|
21
21
|
function slimTracebackOutput(self, tracebackOutput)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if __TS__StringIncludes(lines[2], "in upvalue 'getTraceback'") or __TS__StringIncludes(lines[2], "in function 'sandboxGetTraceback'") then
|
|
25
|
-
__TS__ArraySplice(lines, 1, 1)
|
|
22
|
+
for ____, msg in ipairs(USELESS_TRACEBACK_MESSAGES) do
|
|
23
|
+
tracebackOutput = removeAnyLineThatContains(nil, tracebackOutput, msg)
|
|
26
24
|
end
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return tracebackOutput
|
|
26
|
+
end
|
|
27
|
+
function removeAnyLineThatContains(self, msg, containsMsg)
|
|
28
|
+
local lines = __TS__StringSplit(msg, LINE_SEPARATOR)
|
|
29
|
+
do
|
|
30
|
+
local i = 0
|
|
31
|
+
while i < #lines do
|
|
32
|
+
local line = lines[i + 1]
|
|
33
|
+
if __TS__StringIncludes(line, containsMsg) then
|
|
34
|
+
__TS__ArraySplice(lines, i, 1)
|
|
35
|
+
end
|
|
36
|
+
i = i + 1
|
|
37
|
+
end
|
|
29
38
|
end
|
|
30
|
-
|
|
31
|
-
return slimmedTracebackOutput
|
|
39
|
+
return table.concat(lines, LINE_SEPARATOR or ",")
|
|
32
40
|
end
|
|
41
|
+
LINE_SEPARATOR = "\n"
|
|
42
|
+
USELESS_TRACEBACK_MESSAGES = {"in upvalue 'getTraceback'", "in function 'sandboxGetTraceback'", "in function 'error'"}
|
|
33
43
|
function ____exports.patchErrorFunction(self)
|
|
34
44
|
if not isLuaDebugEnabled(nil) then
|
|
35
45
|
return
|