From 4ddac76611518dbf1cadd96aaa0fab81f2ca0fed Mon Sep 17 00:00:00 2001 From: Ricardo Loureiro Date: Mon, 5 Feb 2024 14:51:26 +0000 Subject: [PATCH] Update StackProcessor.lua --- src/Integrations/StackProcessor.lua | 31 +++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Integrations/StackProcessor.lua b/src/Integrations/StackProcessor.lua index 6d56bdf..ff7b227 100644 --- a/src/Integrations/StackProcessor.lua +++ b/src/Integrations/StackProcessor.lua @@ -55,18 +55,45 @@ local function ConvertStacktraceToFrames(Event, Hint) end end + if SourceScript then + local Parent = SourceScript + Path = "" + + while Parent do + Path = (Parent.Name .. Path) + Parent = Parent.Parent + + if Parent then + Path = ("/" .. Path) + end + end + + if SourceScript:IsA("LocalScript") then + Path ..= ".client" + elseif SourceScript:IsA("Script") then + if SourceScript.RunContext == Enum.RunContext.Client then + Path ..= ".client" + else + Path ..= ".server" + end + end + + Path ..= ".luau" + end + if Path and LineNumber then table.insert(StacktraceFrames, 1, { ["function"] = FunctionName, filename = Path, + abs_path = Path, lineno = tonumber(LineNumber), - module = (if SourceScript then SourceScript.Name else select(-1, unpack(string.split(Path, ".")))), + module = (if SourceScript then SourceScript.Name else select(-1, unpack(string.split(Path, "/")))), vars = SanitizeEnvironment(Variables) }) else table.insert(StacktraceFrames, 1, { - filename = (if SourceScript then SourceScript:GetFullName() else nil), + filename = Path, module = Line, vars = SanitizeEnvironment(Variables) })