basically all variables(except perhaps floats, ints, and bools, not sure) are passed by reference, this means that they may have many references, but only a single value, for example:
singelton code:
var example_var := "My very fine string of text" #storing a "global" string, able to be accessed anywhere! The coma only ensures that only strings may be stored in this var
somewhere in the code inside a node:
func addsometexttotheline():
[thesingelton].examplevar = [thesingelton].example_var + " that is now even longer!!!"
this will update the string globally, if you then access it somewhere completely different later:
func some_later_func():
print([the_singelton].example_var)
you will get the following printout:
My very fine string of text that is now even longer!!!
if you want to avoid this behaviour, you'd in your "addsometexttotheline" function instead write something like this:
func addsometexttotheline():
var mylocalvar = [thesingelton].examplevar + " that is now even longer!!!"
and you'd get the following printout:
My very fine string of text