What are the built-in array syntax rules in this example...

I’m trying to understand the individual pieces of a tetris clone I found (to the original maker, thank you! I can’t find
the original anymore…)
I’m trying to understand the individual parts so I can recreate something similar.
I’ve removed various parts. What’s left works together with a different script which is attached
to an empty. If I press spacebar in that script, it
instantiates another empty, which has this script attached.

This script is supposed to gather a number of cube shaped primitives (which it successfully does), in the shape that the block string array designates, trough a table of 1s and 0s in the inspector. As a tetrimino it’s like this:
oooo
1111
oooo
oooo

What I don’t understand, as I seem unable to find documentation for the syntax, is how, in the “if” statement", the information
in the parenthesis is interpreted. How do the temporary variables x and y, correspond to the grid of 1s and 0s in
the built-in array in the inspector? What are the syntax rules for making built-in arrays in the code example?

If I’m missing some vital information, please let me know :slight_smile:

And just to make sure I’m clear: I didn’t make this script, I’m just trying to understand it. Not trying to steal or take credit from anyone.

var block : String [];

private var size : int;
private var halfSize : int;
private var halfSizeFloat : float;

function Start () {
	// Sanity checking. 
	size = block.Length;
	
	halfSize = size/2;
	halfSizeFloat = size*.5; // halfSize is an integer for the array, but we need a float for positioning the on-screen cubes (for odd sizes)
	
	// Convert block string array from the inspector to a boolean 2D array for easier usage
	for (y = 0; y < size; y++){
		for (x = 0; x < size; x++){
			if (block[y][x] == "1"){
				var block = Instantiate(Button.use.cube, Vector3(x-halfSizeFloat, (size-y)+halfSizeFloat-size, 0.0), Quaternion.identity) as Transform;
				block.parent = transform;
			}
		}
	}
}

block is an array of strings. Arrays and strings are both indexable with the square bracket syntax.

The expression

block[y]

Will give you the xth letter of the yth string…