Modify entity type globally

For my project, I want to be able to change all func_door’s so that:

func_door = ‘touch opens’ flag disabled

I can’t get this to work, then again my syntax is probably awful:

[lua]
function hopfix()
for k,v in pairs( ents.GetAll() ) do
if ent:GetClass() == “func_button” then
ent:SetKeyValue(“spawnflags”,“2048”)
end
end
end
hook.Add(“InitPostEntity”, “hopfix”, hopfix)
[/lua]

Hook ‘hopfix’ Failed: [blodey\gamemode\shared.lua:15] attempt to index global ‘ent’ (a nil value)

Ent is not defined.
[lua]
function hopfix()
for _,ent in pairs( ents.GetAll() ) do – Replaced v with ent. Making the code defining ent. I also removed k because we do not need it.
if ent:GetClass() == “func_door” then
ent:SetKeyValue(“spawnflags”,“2048”)
end
end
end
hook.Add(“InitPostEntity”, “hopfix”, hopfix)
[/lua]

I see, now I feel dumb. looks up definition

Using an underscore doesn’t remove the variable, it’s just used to show that we don’t need it. It’s still there.

Is there something I have to do there?

No, that code should work just fine.