Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate some issues with reserved words #3236

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lua/entities/gmod_wire_expression2/core/e2lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -676,9 +676,7 @@ E2Lib.ReservedWord = {
["in"] = true,
instanceof = true,
interface = true,
match = true,
macro = true,
mod = true,
module = true,
mut = true,
namespace = true,
Expand All @@ -701,7 +699,6 @@ E2Lib.ReservedWord = {
typeof = true,
undefined = true,
union = true,
use = true,
yield = true,
var = true,
}
Expand Down
6 changes: 5 additions & 1 deletion lua/entities/gmod_wire_expression2/core/entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Loading