what does self. do? [Solved]

Hi. I’ve been wondering what self. did for a while now. There’s lots of them in the example projects but i just don’t know what they do. I’ve been looking in the tutorials but I haven’t found it. Can someone explain to me what self. does?

And example is:

Test = class()

self.x = x
self.y = y
--x and y are variables that are defined when :init is called in setup()
--self.x and self.y are the same as x and y, but can only be used with the Test class.

self is used in classes to define variables that only apply to that class.

@Kolosso - try these



Thanks. I did a little testing, and now I think I get it.