diff --git a/lua/entities/gmod_wire_expression2/core/weapon.lua b/lua/entities/gmod_wire_expression2/core/weapon.lua index 1ed134604d..d10ce24f72 100644 --- a/lua/entities/gmod_wire_expression2/core/weapon.lua +++ b/lua/entities/gmod_wire_expression2/core/weapon.lua @@ -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