Is it possible to get array comparisons (by reference)? I think this should work:
Function Main()
Local foo:Int[] = [1, 2, 3]
Local bar:Int[] = foo
If bar = foo Then
Print "equal by reference"
Else
Print "not equal by reference"
End
bar = [1, 2, 3]
If bar = foo Then
Print "equal by reference"
Else
Print "not equal by reference"
End
End Basically it would first print "equal by reference" because the foo array was directly assigned to bar, and then "not equal by reference" because the bar array has been assigned a new object (albeit with the same contents).
Function Main()
Local foo:Int[] = [1, 2, 3]
TestFunc(foo)
Print(foo[0])
End
Function TestFunc(bar:Int[])
bar[0] = 5
End If that prints 5, then array comparison by reference should be possible (and trivial?).
|