BCE0048: Type 'boolean' does not support slicing.

Here is all of the code I have in the script in question:

#pragma strict

var grid = new boolean[0,0];

function Start () {
	var terrainSize = GetComponent(Terrain).terrainData.size;
	grid = new boolean[terrainSize.x, terrainSize.z];
}

function getGrid (x, y) {
	return grid[x][y];
}

function setGrid (x, y, aValue) {
	grid[x][y] = aValue;
	return null;
}

The problems I am having are:
1: I can’t find a way of initialising grid within ‘Start’ and also making it ‘global’. ie, accessable in setGrid and getGrid, not in other scripts.

2: Using what I am at the moment causes this error:

Assets/Scripts/TerrainManagement.js(15,20): BCE0048: Type ‘boolean’ does not support slicing.

and another for the second grid[y]

Javascript novice, sorry for silly questions.

grid[x][y] should be grid[x,y] for the type of array you’re using.

.NET distinguishes between “multi-dimensional” and “jagged” arrays. You’ve declared a multi-dimensional array, but the syntax you use to access it is what you’d use for a jagged array.

If you’d like to know more, these explain a bit and might give clues for further reading: