View Single Post
  #26  
Old 02-02-2008, 02:20 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I don't believe doing things like declaring variables private/public/protected with keywords will work in GS2.

This is because GS2 has no support for such things. const is not real value type because the compiler is merely reading it and replacing instances of it in the script with its value on compile time. After the script is compiled it no longer exists. Its about the same thing as C++'s #define.

As I said, GS2 has no support for such things for it would not be possible to do it without lots of changes that are unnecessary. That is why I suggested the Python method where variables (or functions) that have a name starting with _ are private:
PHP Code:
function onCreated() {
  
this.publicvar 5;
  
this._privatevar 7;
}
function 
_privatefunc() {
}
function 
notreallyprivatefunc() {
}
public function 
publicfunc() {

I believe thats a better option than the this.private. prefix.
__________________
Reply With Quote