From 17cfe004a03dcd17645316929f47ffcf60f40330 Mon Sep 17 00:00:00 2001 From: March Cain Date: Thu, 9 Jan 2020 20:51:26 -0800 Subject: [PATCH 1/4] Fix nil error --- lua/entities/gmod_wire_expression2/core/number.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/core/number.lua b/lua/entities/gmod_wire_expression2/core/number.lua index 6e73ab5c13..62ea2d5c25 100644 --- a/lua/entities/gmod_wire_expression2/core/number.lua +++ b/lua/entities/gmod_wire_expression2/core/number.lua @@ -81,7 +81,7 @@ __e2setcost(1.5) registerOperator("eq", "nn", "n", function(self, args) local op1, op2 = args[2], args[3] - local rvd = op1[1](self, op1) - op2[1](self, op2) + local rvd = op1[1](self, op1) or 0 - op2[1](self, op2) or 0 if rvd <= delta && -rvd <= delta then return 1 else return 0 end end) From 196f82548a86927d233c98a8e680cbf63fa04b60 Mon Sep 17 00:00:00 2001 From: March Cain Date: Fri, 10 Jan 2020 00:32:19 -0800 Subject: [PATCH 2/4] Removed previous change --- lua/entities/gmod_wire_expression2/core/number.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/core/number.lua b/lua/entities/gmod_wire_expression2/core/number.lua index 62ea2d5c25..6e73ab5c13 100644 --- a/lua/entities/gmod_wire_expression2/core/number.lua +++ b/lua/entities/gmod_wire_expression2/core/number.lua @@ -81,7 +81,7 @@ __e2setcost(1.5) registerOperator("eq", "nn", "n", function(self, args) local op1, op2 = args[2], args[3] - local rvd = op1[1](self, op1) or 0 - op2[1](self, op2) or 0 + local rvd = op1[1](self, op1) - op2[1](self, op2) if rvd <= delta && -rvd <= delta then return 1 else return 0 end end) From b1ae3573f5d8af488abd6574a9fd401da58d9b98 Mon Sep 17 00:00:00 2001 From: March Cain Date: Fri, 10 Jan 2020 00:33:53 -0800 Subject: [PATCH 3/4] Update entity.lua --- lua/entities/gmod_wire_expression2/core/entity.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/entity.lua b/lua/entities/gmod_wire_expression2/core/entity.lua index bb9704328f..b3e6864806 100644 --- a/lua/entities/gmod_wire_expression2/core/entity.lua +++ b/lua/entities/gmod_wire_expression2/core/entity.lua @@ -347,13 +347,13 @@ end e2function number entity:volume() if not validPhysics(this) then return 0 end local phys = this:GetPhysicsObject() - return phys:GetVolume() + return phys:GetVolume() or 0 end e2function number entity:surfaceArea() if not validPhysics(this) then return 0 end local phys = this:GetPhysicsObject() - return phys:GetSurfaceArea() + return phys:GetSurfaceArea() or 0 end e2function number entity:stress() From 646380291d8c3e4d4b65c97590526fe8fb2748da Mon Sep 17 00:00:00 2001 From: March Cain Date: Fri, 10 Jan 2020 00:35:30 -0800 Subject: [PATCH 4/4] Fix #2 --- lua/entities/gmod_wire_expression2/core/entity.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/core/entity.lua b/lua/entities/gmod_wire_expression2/core/entity.lua index b3e6864806..35ab046e93 100644 --- a/lua/entities/gmod_wire_expression2/core/entity.lua +++ b/lua/entities/gmod_wire_expression2/core/entity.lua @@ -359,7 +359,7 @@ end e2function number entity:stress() if not validPhysics(this) then return 0 end local phys = this:GetPhysicsObject() - return phys:GetStress() + return phys:GetStress() or 0 end /******************************************************************************/