From b6dc1b2afb096a8b0f8b9372b71d02cc29673eae Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 29 Aug 2026 23:00:19 +0300 Subject: [PATCH 1/2] Fix exit() resetting quota in some cases --- lua/entities/gmod_wire_expression2/init.lua | 36 ++++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index f14dfe0e45..51d2fc2f20 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -159,19 +159,17 @@ function ENT:Execute(script, context) if not ok then local _catchable, msg, trace = E2Lib.unpackException(msg) - if msg == "exit" then - self:UpdatePerf(selfTbl) - elseif msg == "perf" then - local trace = context.trace or trace - + if msg == "perf" then + trace = context.trace or trace self:UpdatePerf(selfTbl) self:Error("Expression 2 (" .. selfTbl.name .. "): tick quota exceeded (at line " .. trace.start_line .. ", char " .. trace.start_col .. ")", "tick quota exceeded") - elseif trace then - self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") - else - local trace = context.trace or trace - - self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + elseif msg ~= "exit" then + if trace then + self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + else + trace = context.trace or trace + self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + end end end @@ -245,17 +243,17 @@ function ENT:ExecuteEvent(evt, args) if not ok then local _catchable, msg, trace = E2Lib.unpackException(msg) - if msg == "exit" then - self:UpdatePerf(selfTbl) - elseif msg == "perf" then + if msg == "perf" then local trace = context.trace self:UpdatePerf(selfTbl) self:Error("Expression 2 (" .. selfTbl.name .. "): tick quota exceeded (at line " .. trace.start_line .. ", char " .. trace.start_col .. ")", "tick quota exceeded") - elseif trace then - self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") - else - local trace = context.trace - self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + elseif msg ~= "exit" then + if trace then + self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + else + trace = context.trace + self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + end end end From d2ba0560e14d88ed95c3a19639e2ddedb835c573 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 29 Aug 2026 23:02:38 +0300 Subject: [PATCH 2/2] Small lint pass --- lua/entities/gmod_wire_expression2/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index 51d2fc2f20..944d2c7a77 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -244,7 +244,7 @@ function ENT:ExecuteEvent(evt, args) local _catchable, msg, trace = E2Lib.unpackException(msg) if msg == "perf" then - local trace = context.trace + trace = context.trace self:UpdatePerf(selfTbl) self:Error("Expression 2 (" .. selfTbl.name .. "): tick quota exceeded (at line " .. trace.start_line .. ", char " .. trace.start_col .. ")", "tick quota exceeded") elseif msg ~= "exit" then