Well, i have an array< Array < int > > called map, inthis array there is number like 1 and 2 and other numbers
i want to change the 2 for 1 then i use this code, it works in neko but dont change the 2 in map on Windows just in neko
var ai:Array<Int> = new Array<Int>();
ai.push(1);
ai.push(2);
trace("ai: " + ai);
//create the collsion map
for (row in 0...map.length)
{
for (cell in 0...map[row].length)
{
for (c in ai)//JsonManager.instance.get_arrayBlock()
{
if (map[row][cell] == c)
{
map[row][cell] = 1;
}
}
}
}
Try printing more data:
for (row in 0...map.length)
{
for (cell in 0...map[row].length)
{
for (c in ai)
{
trace (map[row][cell] + " == " + c + "?");
if (map[row][cell] == c)
{
trace (map[row][cell] + " -> 1");
map[row][cell] = 1;
}
}
}
}
the trace is printing the same data to neko and windows… but in windows target it just dont update/modify the array, is like you just cant modify an already created array on windows target,
You can definitely modify arrays on Windows. If you doubt this, here’s a simple test to prove it:
map[0][0] = 0;
trace(map[0][0]);
map[0][0] = 1;
trace(map[0][0]);
map[0][0] = 2;
trace(map[0][0]);
Are you sure it’s printing exactly the same data, rather than mostly the same data? Try searching the output for “2 -> 1
,” and make sure it appears enough times.
Or be a little pickier about what you print:
for (row in 0...map.length)
{
for (cell in 0...map[row].length)
{
for (c in ai)
{
if (map[row][cell] == c)
{
map[row][cell] = 1;
if (c == 2) {
trace (map[row][cell]);
}
}
}
}
}