Variable Reference?

BlitzMax Forums/BlitzMax Beginners Area/Variable Reference?

po(Posted 2009) [#1]
Hey,

Is there a way to create a variable 'reference' that when changed, the original variable is also changed? I've taken a look at pointers, but I'm a bit confused by them.

Any help is appreciated.


Htbaa(Posted 2009) [#2]
You can use Var for that.


po(Posted 2009) [#3]
Huh. I completely forgot about Var. Thanks!


po(Posted 2009) [#4]
How would you go about applying Var to a field in an object?
ie.

Type TFoo

Field num% Var

End Type

That doesn't seem to work.


N(Posted 2009) [#5]
In the case of a field, you'd have to use a pointer, but I wouldn't advise that sort of thing. You'd be better off synchronizing the values between objects in some sort of explicit (in this case, meaning you have code to do it manually) manner.


po(Posted 2009) [#6]
Alright, thanks.