Why aren't my custom Methods on entities working?

I know I am probably a idiot on this but I was trying to code some setter and getter methods for my entity so that I could call them on that entity any time I want to, but whenever I set the methods and try to call them it says it can not find them.

Example:
[lua]

–ENTITY CODE

function setCap(num)
ent.cap = num;
end

–I tried it two ways to see if I was doing it wrong or something

function ENT:setCap(num)
ent.cap = num;
end
[/lua]

[lua]
–OTHER CODE

             activator.ent_at = e 

–Set the entity to one of the players tables

	print(activator.ent_at) 

–Test to make sure it is retreiveing the entity so i can call methods on it

	activator.ent_at:setCap(10) 

–Attempt to call method
[/lua]

ERROR:
[lua]

[ERROR] addons/clothesmod/lua/entities/clothes2.lua:172: attempt to call method ‘setCap’ (a nil value)

  1. unknown - addons/clothesmod/lua/entities/clothes2.lua:172

[/lua]

In Lua, when you define a function such as ENT:
it automagically adds self, so



function ENT:setCap(num)

is the same as

function ENT.setCap( self, num )


So, instead of ent.cap, it should be self.cap
lastly, is the function in the same Lua file where it is being called?

Yes but my plan later on is to be able to call that method and simply set it from a completely different file.

I am a idiot I had it in the wrong file. I need to stop coding late at night.