Community Forum

Variables with self prefix

Forum Overview >> Scripting

Created18.06.2009 20:22

Claudio Accotardi (Unknown) 18.06.2009 20:28
I don't undestend what is the function of variables self.xxxx .
The variables self.xxxx are alredy define when the game is running? If is like this, there is a list?
Best regards

Matthias B. (Unknown) 18.06.2009 23:13
self is not a defined keyword, but given in lua to get variables of your class. i think it´s the same like namespace in visual basic etc isn´t it?

Christian Ammann - GIANTS Software 18.06.2009 23:50
You can access member variables with the self prefix. Example:

function MyClass:printMyVar()
print("myVar: ", self.myVar);

you should treat self as a keyword.

Claudio Accotardi (Unknown) 19.06.2009 19:08
Best regards

Gh Portefait (Unknown) 11.05.2013 22:56

Note: Log in to post. Create a new account here.