Daniel Mallett
Member
Would someone confirm the only difference between an instance variable and a local variable 'var' is that variables initialized with var can't be accessed from outside? I have complete several projects with GM now but I have never needed to use local variables. Just instance and global ones. I'm concerned about this because I want to optimize.
Would it be fair to say that...
1) if a variable needs to be accessed from outside the object instance should be instant or global
2) local variables are more system efficient
3) Predefining a variable size with a function is more efficient (Provided you know the size)
4) A global variable like constants, no matter where they are defined gets initialized first.
5) Accessing outside variables with a dot 'this.that' is not as efficient as calling a global or calling a local from itself.
6) Creating a variable with a predefined size creates instance variables.
None of these things stop me from working but some clarity on this would be great. And yes I know there is a manual.
Edit: I have a huge number of variables that need to be accessed from outside the object it resides in. For example, I don't use magic numbers, EVER. So my settings object needs to potentially talk to any variable. Colours, sizes, scales, visibility, size limits etc. I can't think of hardly any variables that don't need to be accessed from outside.
Would it be fair to say that...
1) if a variable needs to be accessed from outside the object instance should be instant or global
2) local variables are more system efficient
3) Predefining a variable size with a function is more efficient (Provided you know the size)
4) A global variable like constants, no matter where they are defined gets initialized first.
5) Accessing outside variables with a dot 'this.that' is not as efficient as calling a global or calling a local from itself.
6) Creating a variable with a predefined size creates instance variables.
None of these things stop me from working but some clarity on this would be great. And yes I know there is a manual.
Edit: I have a huge number of variables that need to be accessed from outside the object it resides in. For example, I don't use magic numbers, EVER. So my settings object needs to potentially talk to any variable. Colours, sizes, scales, visibility, size limits etc. I can't think of hardly any variables that don't need to be accessed from outside.