DaveInDev
Member
I'm a bit lost. I thought that assigning an array to a variable was not copying it, but just making a reference to this array ?
Why is this code not working as I thought it should ?
Looking at the debugger, it seems that t is another array of its own, distinct from global.arr ...
Why is this code not working as I thought it should ?
Looking at the debugger, it seems that t is another array of its own, distinct from global.arr ...
GML:
global.arr= [
[1,1,1],
[2,2,2]
]
function test()
{
var t;
t = global.arr[0];
t[1] = 10; // does not modify global.arr ?
t[2] = 12;
}