I experienced some weird behavior with exceeding array bounds and so I wrote a tiny program to help isolate some of the cases. I am simply irked by the way the engine reacts (or doesn't) to bad array indices, and I wish there was a consistent way that it did--especially because, as I will show, bad array assignments are sometimes totally tolerated.

Case 1:
Code:
function main()
{
	var array[3];
	
	int i = 0;
	for(; i<=3; i++)
		array[i] = array[i+1];
	wait(-2);
	sys_exit(NULL);
}


This bad for() loop, which accesses "members" of the array 2 indices outside of its bounds, freezes the engine and requires a CTRL-ALT-DELETE.

Case 2:
The following code actually RUNS with no apparent error:
Code:
function main()
{
	var array[3];
	
	array[100] = 50;	

	wait(-2);
	sys_exit(NULL);
}


A crash only occurs if you try to access it later, e.g. array[0]=array[100];.

Amazingly, even absurd array indices such as 67.5 do not cause a crash immediately--only when they are accessed.

Never once does an engine message pop up saying "Script crash--bad array index." The engine simply crashes.

It seems dangerous to not have a specific error message occur for these types of errors, which are very common. Engine freezes and crashes can happen by plenty of other things, in the case of freezing when in fullscreen, this causes a major inconvenience. Even worse is the case of the apparent success in assigning to a bogus array index... no error message implies no error, and bad array calls are hard to find. That's why we need a "BAD ARRAY INDEX IN SYS" message.