Skip to content

Commit d6b7784

Browse files
committed
Use original collected debug info for timer functions
1 parent 8ebc2f4 commit d6b7784

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

lua/blobsprofiler/shared/modules/bp_timers.lua

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -125,30 +125,16 @@ blobsProfiler.RegisterModule("Timers", {
125125
{
126126
name = "View source",
127127
func = function(ref, node, luaState)
128-
if luaState == "Client" and isfunction(ref.value.func) then
129-
local debugInfo = debug.getinfo(ref.value.func, "S")
130-
if not string.EndsWith(debugInfo.short_src, ".lua") then
131-
Derma_Message("Invalid function source: ".. debugInfo.short_src.."\nOnly functions defined in Lua can be read!", "Function view source", "OK")
132-
return
133-
end
134-
135-
net.Start("blobsProfiler:requestSource")
136-
net.WriteString(debugInfo.short_src)
137-
net.WriteUInt(debugInfo.linedefined, 16)
138-
net.WriteUInt(debugInfo.lastlinedefined, 16)
139-
net.SendToServer()
140-
else
141-
if not string.EndsWith(ref.value.short_src, ".lua") then
142-
Derma_Message("Invalid function source: ".. ref.value.short_src.."\nOnly functions defined in Lua can be read!", "Function view source", "OK")
143-
return
144-
end
145-
146-
net.Start("blobsProfiler:requestSource")
147-
net.WriteString(ref.value.short_src)
148-
net.WriteUInt(ref.value.linedefined, 16)
149-
net.WriteUInt(ref.value.lastlinedefined, 16)
150-
net.SendToServer()
128+
if not string.EndsWith(ref.value.short_src, ".lua") then
129+
Derma_Message("Invalid function source: ".. ref.value.short_src.."\nOnly functions defined in Lua can be read!", "Function view source", "OK")
130+
return
151131
end
132+
133+
net.Start("blobsProfiler:requestSource")
134+
net.WriteString(ref.value.short_src)
135+
net.WriteUInt(ref.value.linedefined, 16)
136+
net.WriteUInt(ref.value.lastlinedefined, 16)
137+
net.SendToServer()
152138
end,
153139
icon = "icon16/magnifier.png"
154140
},

0 commit comments

Comments
 (0)