What is 'self' and how can it be used?

Hello. I lately saw self when I was programming a game, and I do not really understand how to use it and if it’s useful. Can somebody explain to me how do I use self and what it’s useful for?

The only time I use self is when working with OOP, Object Oriented Programming, my understanding of metatables and oop is pretty lacking so I’m not comfortable explaining it, but here is a good post explaining oop and should hopefully give you an understanding about when self is used.

2 Likes

Roblox uses them in methods
So if you want to create your own methods it’s useful
https://developer.roblox.com/en-us/articles/Method

2 Likes

Okay. Thank you for your answer!

Okay, thank you for answering!

@XDvvvDX, There is a beautiful and wonderful machine called Google, please don’t be lazy, you can find it in literally 4 seconds.

Dont be lazy pls.

1 Like

I did search that on google. But all the answers for the topics I’ve found so far did not help me.

And my linked topic didn’t help you? No jokes, just to understand. Well, the important thing is that you understand what it does. If so, then welcome to the OOP world

Your link did help me, but when I scrolled through google I did not really find the topic that you sent me.

1 Like

np, have a nice day 30charsssss

1 Like

Thank you. Have a good day! :smiley: