Metatables: When should I use self?

Hi there!

If I am using a metatable, when should I use self to define variables? Is it always better to use self? I’ve been using self for most things, but I don’t know if that’s the most efficient method. I can’t really find something which provides a good list of situations in which to use self and ones which to not.

This isn’t neccesarily for this one project, I just want this as a general template to follow for any times I may use metatables in the future. I’m mostly thinking about optimisation if that was not clear.

Thanks in advance.

Well just so you know, self isn’t necessarily just for metatables, self is related to functions, how that works is:

function DoSomething.Start(self)
end

DoSomething:Start()

in this scenario the table DoSomething would be returned as the first argument cause you used a colon instead of a dot

this video explains it pretty well