Frequently Asked Questions about self. and other syntax

FIRSTLY, if you don’t know about self or some another syntax like me now - read comments below project

Hi,kind folks. I have some unanswered questions like “wtf is this self.value” and this post (I expect) will help me and other men like me. How I search in Google and entirely on his forum I have some information about self. and return values. But I don’t sure I have right understand about this . In my vision return (for example x = 2) in this function

function f (x)
   return x^2
end

Makes x equal to 4 (am I right?)

And about self.value . Jvm said its local and static for project . How I read in ignatz book it’s stores information for this value. All in all I want some examples .

P.s sorry for my bad English
P.p.s if moderator consider delete post - do it, but I think some examples/pieces of code from stars of lua will be very useful

Try reading this

http://coolcodea.wordpress.com/2013/03/22/7-classes-in-codea/

and then this

http://coolcodea.wordpress.com/2013/03/23/8-classes-in-codea-2/

@ignatz thank kind sir

@lupino8211 I don’t know if this will help, but think of a class as a notebook folder that doesn’t have any paper in it yet. Then imagine each sheet of paper that you add to the notebook as an instance in that class. The information on each sheet is seperate from each other sheet and is stored using the self variable. Each sheet of paper has a unique name of that class and the information is referenced using that name. You can add more sheets of paper or you can remove sheets of paper. But as long as the information is stored using the self variable, it’s unique to that sheet of paper.

@dave1707 thank you very much . Hope this explanation will help other people like me