Checking If A Model Exists

Very simple question.

I need an if-then-else that checks if a model typed in a convar exists. If not, uses defaults.

[lua]if ( validity_of_model == false ) then – Replace “validity_of_model” with whatever the function is.
self.Entity:SetModel(“models/default_ent_model.mdl”)
else
self.Entity:SetModel(modelconvar)
end[/lua]

[lua]file.Exists( “…/modelpath” )[/lua]

The ‘…/’ means that it will look for the path in your gmod directory.

util.IsValidModel( str:modelpath )?

THAT looks promising.

Will post after testing to see if it worked.