mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Mitigate some issues with reserved words (#3236)
* Add entity:getClass * Remove some common reserved words * lint
This commit is contained in:
parent
c4d0ca9855
commit
4262b11969
@ -474,7 +474,7 @@ else
|
|||||||
function E2Lib.isOwner(self, entity)
|
function E2Lib.isOwner(self, entity)
|
||||||
local owner = E2Lib.getOwner(self, entity)
|
local owner = E2Lib.getOwner(self, entity)
|
||||||
if not IsValid(owner) then return false end
|
if not IsValid(owner) then return false end
|
||||||
|
|
||||||
return E2Lib.isFriend(owner, self.player)
|
return E2Lib.isFriend(owner, self.player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -676,9 +676,7 @@ E2Lib.ReservedWord = {
|
|||||||
["in"] = true,
|
["in"] = true,
|
||||||
instanceof = true,
|
instanceof = true,
|
||||||
interface = true,
|
interface = true,
|
||||||
match = true,
|
|
||||||
macro = true,
|
macro = true,
|
||||||
mod = true,
|
|
||||||
module = true,
|
module = true,
|
||||||
mut = true,
|
mut = true,
|
||||||
namespace = true,
|
namespace = true,
|
||||||
@ -701,7 +699,6 @@ E2Lib.ReservedWord = {
|
|||||||
typeof = true,
|
typeof = true,
|
||||||
undefined = true,
|
undefined = true,
|
||||||
union = true,
|
union = true,
|
||||||
use = true,
|
|
||||||
yield = true,
|
yield = true,
|
||||||
var = true,
|
var = true,
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,15 @@ e2function string entity:name()
|
|||||||
return this:GetName() or ""
|
return this:GetName() or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
e2function string entity:type()
|
[nodiscard]
|
||||||
|
e2function string entity:getClass()
|
||||||
if not IsValid(this) then return self:throw("Invalid entity!", "") end
|
if not IsValid(this) then return self:throw("Invalid entity!", "") end
|
||||||
return this:GetClass()
|
return this:GetClass()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
[deprecated = "Use getClass"]
|
||||||
|
e2function string entity:type() = e2function string entity:getClass()
|
||||||
|
|
||||||
e2function string entity:model()
|
e2function string entity:model()
|
||||||
if not IsValid(this) then return self:throw("Invalid entity!", "") end
|
if not IsValid(this) then return self:throw("Invalid entity!", "") end
|
||||||
return this:GetModel() or ""
|
return this:GetModel() or ""
|
||||||
|
Loading…
Reference in New Issue
Block a user