Code: Select all
object := {A:1, B:2}
thing := object
thing["A"] := 2
array := [1, 2]
thing2 := array
thing2[1] := 2
msgbox % object["A"] . ", " . array[1] ;<both return 2 but I want them to return 1
return
Code: Select all
object := {A:1, B:2}
thing := object
thing["A"] := 2
array := [1, 2]
thing2 := array
thing2[1] := 2
msgbox % object["A"] . ", " . array[1] ;<both return 2 but I want them to return 1
return
Ah ok. So it should look like thisFlipeador wrote:Related: https://autohotkey.com/boards/viewtopic ... 7&p=229505.
Current behavior is fine. You must clone the object.
Code: Select all
object := {A:1, B:2}
thing := object.clone()
thing["A"] := 2
array := [1, 2]
thing2 := array.clone()
thing2[1] := 2
msgbox % object["A"] . ", " . array[1]