From e7fe6dedcf6c36149364eab91ecd3ac86e12c3a5 Mon Sep 17 00:00:00 2001 From: deltamolfar <72973198+deltamolfar@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:59:20 +0300 Subject: [PATCH 1/2] add alliases --- lua/entities/gmod_wire_expression2/core/timer.lua | 14 ++++++++++++-- lua/wire/client/e2descriptions.lua | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/timer.lua b/lua/entities/gmod_wire_expression2/core/timer.lua index ed042a72ef..7a8e71c39e 100644 --- a/lua/entities/gmod_wire_expression2/core/timer.lua +++ b/lua/entities/gmod_wire_expression2/core/timer.lua @@ -104,11 +104,11 @@ local function luaTimerCreate(self, name, delay, repetitions, callback) } timer.Create(internalName, delay, repetitions, function() - ent:Execute(callback) - if timer.RepsLeft(internalName) == 0 then luaTimers[entIndex][name] = nil end + + ent:Execute(callback) end) end @@ -238,6 +238,16 @@ e2function void timer(string name, number delay, function callback) end __e2setcost(5) +e2function void timerStop(string name) + RemoveTimer(self, name) + pcall(luaTimerRemove, self, name) +end + +e2function void timerRemove(string name) + RemoveTimer(self, name) + pcall(luaTimerRemove, self, name) +end + e2function void timerSetDelay(string name, number delay) if not luaTimerExists(self, name) then return self:throw("Timer with name " .. name .. " does not exist", nil) diff --git a/lua/wire/client/e2descriptions.lua b/lua/wire/client/e2descriptions.lua index 79d23fdca4..eee5b57f2b 100644 --- a/lua/wire/client/e2descriptions.lua +++ b/lua/wire/client/e2descriptions.lua @@ -1002,6 +1002,8 @@ E2Helper.Descriptions["runOnTick(n)"] = "DEPRECATED. Use 'event tick()' instead! E2Helper.Descriptions["timer(sn)"] = "DEPRECATED. Use 'timer(sf)' (lambda timer) instead! Sets a one-time timer with entered name and delay in milliseconds" E2Helper.Descriptions["stoptimer(s)"] = "Stops a timer, can stop interval with stoptimer(\"interval\")" E2Helper.Descriptions["stopAllTimers()"] = "Stops all timers" +E2Helper.Descriptions["timerStop(s)"] = "Alias of stoptimer(s). " .. E2Helper.Descriptions["stoptimer(s)"] +E2Helper.Descriptions["timerRemove(s)"] = "Alias of stoptimer(). " .. E2Helper.Descriptions["stoptimer(s)"] E2Helper.Descriptions["timerSetDelay(sn)"] = "Sets the delay of the timer with the name S to N seconds" E2Helper.Descriptions["timerSetReps(sn)"] = "Sets the number of repetitions of the timer with the name S to N" E2Helper.Descriptions["timerAdjust(snn)"] = "Sets the delay and repetitions of the timer with the name S to N seconds and N repetitions" From 205de379f12e83950b201bb25ac5d93d26092b61 Mon Sep 17 00:00:00 2001 From: deltamolfar <72973198+deltamolfar@users.noreply.github.com> Date: Sun, 12 Oct 2025 14:12:56 +0300 Subject: [PATCH 2/2] Update timer.lua --- lua/entities/gmod_wire_expression2/core/timer.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/timer.lua b/lua/entities/gmod_wire_expression2/core/timer.lua index 7a8e71c39e..49781bb96a 100644 --- a/lua/entities/gmod_wire_expression2/core/timer.lua +++ b/lua/entities/gmod_wire_expression2/core/timer.lua @@ -238,15 +238,8 @@ e2function void timer(string name, number delay, function callback) end __e2setcost(5) -e2function void timerStop(string name) - RemoveTimer(self, name) - pcall(luaTimerRemove, self, name) -end - -e2function void timerRemove(string name) - RemoveTimer(self, name) - pcall(luaTimerRemove, self, name) -end +e2function void timerStop(string rv1) = e2function void stoptimer(string rv1) +e2function void timerRemove(string rv1) = e2function void stoptimer(string rv1) e2function void timerSetDelay(string name, number delay) if not luaTimerExists(self, name) then