Self not existing...

When i go to make a networked variable in init.lua, it says this:

:12: attempt to index global 'self' (a nil value)

line 12:
self.Entity:SetNetworkedVar(k, v)
Man WTF?! Isnt self like… nesecary?
The function i am using this is:
function send()
for k,v in pairs(Info) do
self.Entity:SetNetworkedVar(k, v)

Wrong section, and you need to provide your original code.

Oh whoops sorry yea it is the wrong section. I hope i dont get banned… Can a mod just move this to noobie questions?

No need to move this or to post the original code. It’s simply because you have not defined self. Self is only automatically defined when you are making methods. So if this is in an entity you would need to rename your method to ENT:send().

It really doesn’t matter what self is, but the three common selfs are SWEP ENT and PANEL, though PANEL doesn’t have to be named PANEL, but it is used that way regardless.

self isn’t ‘‘common’’ to those things, it’s just the variable that’s used to define the object you’re calling a function on, if you use the : operator.

“self” is not defined.

Please read the sticky’s which points you to a wonderful tutorial on the very basics of lua.

self.Entity is pointless and deprecated too, just use self and it will work just the same.