From 4262b11969571a62a7d488f5c878aa2e1011d6d4 Mon Sep 17 00:00:00 2001 From: Denneisk <20892685+Denneisk@users.noreply.github.com> Date: Mon, 6 Jan 2025 13:43:28 +0000 Subject: [PATCH] Mitigate some issues with reserved words (#3236) * Add entity:getClass * Remove some common reserved words * lint --- lua/entities/gmod_wire_expression2/core/e2lib.lua | 5 +---- lua/entities/gmod_wire_expression2/core/entity.lua | 6 +++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/e2lib.lua b/lua/entities/gmod_wire_expression2/core/e2lib.lua index e1db2c58d9..a4eeffdcbe 100644 --- a/lua/entities/gmod_wire_expression2/core/e2lib.lua +++ b/lua/entities/gmod_wire_expression2/core/e2lib.lua @@ -474,7 +474,7 @@ else function E2Lib.isOwner(self, entity) local owner = E2Lib.getOwner(self, entity) if not IsValid(owner) then return false end - + return E2Lib.isFriend(owner, self.player) end end @@ -676,9 +676,7 @@ E2Lib.ReservedWord = { ["in"] = true, instanceof = true, interface = true, - match = true, macro = true, - mod = true, module = true, mut = true, namespace = true, @@ -701,7 +699,6 @@ E2Lib.ReservedWord = { typeof = true, undefined = true, union = true, - use = true, yield = true, var = true, } diff --git a/lua/entities/gmod_wire_expression2/core/entity.lua b/lua/entities/gmod_wire_expression2/core/entity.lua index 5c9e6c3b53..e38c6a942f 100644 --- a/lua/entities/gmod_wire_expression2/core/entity.lua +++ b/lua/entities/gmod_wire_expression2/core/entity.lua @@ -104,11 +104,15 @@ e2function string entity:name() return this:GetName() or "" end -e2function string entity:type() +[nodiscard] +e2function string entity:getClass() if not IsValid(this) then return self:throw("Invalid entity!", "") end return this:GetClass() end +[deprecated = "Use getClass"] +e2function string entity:type() = e2function string entity:getClass() + e2function string entity:model() if not IsValid(this) then return self:throw("Invalid entity!", "") end return this:GetModel() or ""