Skip to content

Commit

Permalink
Fix invalid return of of e:weapon() (#3238)
Browse files Browse the repository at this point in the history
  • Loading branch information
Astralcircle authored Jan 4, 2025
1 parent 45c2987 commit 886ef66
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/entities/gmod_wire_expression2/core/weapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ __e2setcost(2) -- temporary

[nodiscard]
e2function entity entity:weapon()
if not IsValid(this) then return nil end
if not this:IsPlayer() and not this:IsNPC() then return nil end
if not IsValid(this) then return self:throw("Invalid entity!", NULL) end
if not this:IsPlayer() and not this:IsNPC() then return self:throw("Expected a Player or NPC but got Entity", NULL) end

return this:GetActiveWeapon()
end

[nodiscard]
e2function entity entity:weapon(string weaponclassname)
if not IsValid(this) then return nil end
if not this:IsPlayer() and not this:IsNPC() then return nil end
if not IsValid(this) then return self:throw("Invalid entity!", NULL) end
if not this:IsPlayer() and not this:IsNPC() then return self:throw("Expected a Player or NPC but got Entity", NULL) end

return this:GetWeapon(weaponclassname)
end
Expand Down

0 comments on commit 886ef66

Please sign in to comment.