I have no idea what’s going on here, but when I pass a javascript array into a function it sorts it??? I don’t want it sorted. What’s causing the output to be sorted?
function linreg(xarray,yarray) {
Debug.Log(xarray);
Debug.Log(yarray);
}
x=new Array(1,2,3,4,5,6,7,8,9,10);
y=new Array(10,9,8,7,6,5,4,3,2,1);
output =
1,2,3,4,5,6,7,8,9,10
1,2,3,4,5,6,7,8,9,10
Thanks,
Dan
The 11 was a typo which I fixed. Thanks for the general tips and speed suggestions. I checked the script independently of the main script it is in and it works. If I change the variable names it works. The main script has many statistics javascript functions I have been porting from html/javascript to unity. Many of the variables in these other functions have var preceding them. Is there a difference in a var declaration inside a function from javascript/html to unityscript that could be causing problems?
– dansav