String array to int array.
Hello. In my aplication i save progress in txt files. Where i save all variables
....//example
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
....
My script load all fast and good, But problem is one. Its loades as String not Number
var variablesList = [];
var variableFile= new File("C://Users//FCT//Documents//testVar.txt"); //open order.txt file
variableFile.open('r');
while (!variableFile.eof) { //get all lines from order txt file
st = variableFile.readln();
variablesList.push(st);
} //end of all lines from order txt file
variableFile.close();
alert(startFrom);
apronBlackCounter=variablesList[0].split(',');
apronFuchsiaCounter=variablesList[1].split(',');
apronRedCounter=variablesList[2].split(',');
apronRoyalBlueCounter=variablesList[3].split(',');
How can i conver that to number when i cant use .map(Number);???
I shuld make" for (var i=0;apronBlackCounter.length; i++){ apronBlackCounter = parseInt(apronBlackCounter);} ". But it wont work...