In the example below, the "f()" function modifies the "x" object sent as parameter when it is called!
Is this a bug?
Code: Select all
x := []
x["Test"] := "xxxxxxx"
f(x)
msgbox, % x["Test"]
;returns "yyyyyyyyyy"
;it should return "xxxxxxx" instead!
;Is this a bug?
f(Options) ;___________ f (Function) ____________
{
Options["Test"] := "yyyyyyyyyy"
}
Code: Select all
x := []
x["Test"] := "xxxxxxx - script"
f(x)
msgbox, % x["Test"]
f(Options) ;___________ f (Function) ____________
{
Options := Options.Clone()
;"Clone()", Returns a shallow (not always a 100% clone???) copy of the object.
;"Clone()" creates a new object from the object referenced by "x" variable!
;then, "Options" variable will reference that newly created/cloned object!
Options["Test"] := "yyyyyyyyyy - function"
msgbox, % Options["Test"]
}