<s>[INST] Why do most programming languages have 0 as the first index of arrays? What are the advantages of that? Why do some languages like Lua start their arrays at 1? [/INST] Zero is commonly used as the first index because it allows multi-dimensional arrays very easily, among ease of compiler implementations. 
Using 0 allows for the array to be indexed as demonstrated in the following example: `array[y + x * x_length]`, where x is the horizontal coordinate, y is the vertical coordinate, and y_length is the maximum value of y + 1. This is equivalent to using multidimensional arrays like this: `array[x][y]`.

It also allows for the compiler to replace `array[n]` with `*(array + n)`, assuming n is a pointer to the first item. There is also an interesting consequence of this: In many languages that handle arrays this way and don't have a very strong type system, like C, `n[array]` is equivalent to `array[n]`.

The benefit of using 1 as the start is that it is usually more intuitive to beginners.</s>