Prevented 2 errors from happening #778

merged 2 commits into from Aug 4, 2014


None yet

6 participants


No description provided.

Leystryku added some commits Aug 4, 2014
@Leystryku Leystryku Update widget.lua
Prevents a stupid error from happening
@Leystryku Leystryku Update nocollide.lua
Prevents a stupid error from happening
@Leystryku Leystryku changed the title from Prevented 2 stupid errors from happening to Prevented 2 errors from happening Aug 4, 2014
@HellaMadMax HellaMadMax commented on the diff Aug 4, 2014
@@ -35,7 +35,7 @@ local function UpdateHovered( pl, mv )
endpos = pl:EyePos() + pl:GetAimVector() * 256,
filter = function( ent )
- return ent:IsValid() && ent:IsWidget()
+ return ent.IsValid && ent:IsValid() && ent:IsWidget()
HellaMadMax Aug 4, 2014 Contributor

Aren't things like this just meant to be "IsValid( ent )"?


The IsValid variant is a bit slower because it would search for the global in _G. It doesn't really matter though

@robotboy655 robotboy655 merged commit 45aa8bf into garrynewman:master Aug 4, 2014
willox commented Aug 4, 2014

#769 (comment)

So is this a rule or not?

Acecool commented Aug 7, 2014

Yeah, it makes sense to use IsValid because it already contains that check, and if an issue arises we can just update it in one spot. For GetClass, maybe an IsValid check should go there, because if it is valid then GetClass will exist.. Either-way it'll resolve the issue.


This looks like it should be IsValid(ent).


I will change it, calm down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment