From 6418fa5ff54866435b1d4b64da9ceeee21459e82 Mon Sep 17 00:00:00 2001 From: AlexALX Date: Thu, 16 Jul 2026 02:29:09 +0300 Subject: [PATCH 1/4] fix chip crashes after duplicated in big dupes I found issue with my ALX PC chips crashing after paste duplication. Its a huge duplication so it has a big delay for paste, and something goes wrong during that. then when i run chip they crash due to table.remove is nil or table.unset is nil in all chips. While debugging i found that persist table variables missing metadata after paste, so e2 functions crashing because of that like: ``` sv: Expression 2 (Internet Connector): Runtime error 'entities/gmod_wire_expression2/core/table.lua:536: attempt to call method 'Unset' (a nil value)' at line -1, char -1 ``` with this change it completely fixes this issue. But have no idea if thats correct way. Correct me if i'm wrong. and i cannot provide easy steps to reproduce, unless share big duplication i have so you can test manually what i mean. Thanks. --- lua/entities/gmod_wire_expression2/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index 1362b8b14f..64dff681d4 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -828,6 +828,11 @@ function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID, GetConstByID) self.GlobalScope[k] = istable(v) and Angle(v[1], v[2], v[3]) or v elseif vartype == "v" then self.GlobalScope[k] = istable(v) and Vector(v[1], v[2], v[3]) or v + elseif vartype == "t" then + if getmetatable(v) == nil then + setmetatable(v, WireLib.E2Table) + end + self.GlobalScope[k] = v else self.GlobalScope[k] = v end From 515ddb1d3fd3219568cfcf1392dab745fd5604ae Mon Sep 17 00:00:00 2001 From: AlexALX Date: Thu, 16 Jul 2026 02:35:49 +0300 Subject: [PATCH 2/4] fix spaces --- lua/entities/gmod_wire_expression2/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index 64dff681d4..1a0a24c2ef 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -828,11 +828,11 @@ function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID, GetConstByID) self.GlobalScope[k] = istable(v) and Angle(v[1], v[2], v[3]) or v elseif vartype == "v" then self.GlobalScope[k] = istable(v) and Vector(v[1], v[2], v[3]) or v - elseif vartype == "t" then - if getmetatable(v) == nil then - setmetatable(v, WireLib.E2Table) - end - self.GlobalScope[k] = v + elseif vartype == "t" then + if getmetatable(v) == nil then + setmetatable(v, WireLib.E2Table) + end + self.GlobalScope[k] = v else self.GlobalScope[k] = v end From 6a4b009f0238332731938d31b2d1e52243ca0926 Mon Sep 17 00:00:00 2001 From: AlexALX Date: Thu, 16 Jul 2026 02:59:09 +0300 Subject: [PATCH 3/4] remove trailing space --- 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 1a0a24c2ef..ee4eb86c2c 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -828,7 +828,7 @@ function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID, GetConstByID) self.GlobalScope[k] = istable(v) and Angle(v[1], v[2], v[3]) or v elseif vartype == "v" then self.GlobalScope[k] = istable(v) and Vector(v[1], v[2], v[3]) or v - elseif vartype == "t" then + elseif vartype == "t" then if getmetatable(v) == nil then setmetatable(v, WireLib.E2Table) end From 6728bdf2556ac8edbddcb5f00d42e2a720438f44 Mon Sep 17 00:00:00 2001 From: AlexALX Date: Thu, 16 Jul 2026 12:48:41 +0300 Subject: [PATCH 4/4] add istable check --- 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 ee4eb86c2c..00610311f9 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -829,7 +829,7 @@ function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID, GetConstByID) elseif vartype == "v" then self.GlobalScope[k] = istable(v) and Vector(v[1], v[2], v[3]) or v elseif vartype == "t" then - if getmetatable(v) == nil then + if istable(v) and getmetatable(v) == nil then setmetatable(v, WireLib.E2Table) end self.GlobalScope[k] = v