I am encountering some weirdness with arrays. My ultimate goal is to add an item onto the end of an existing array. I have approached this in several ways and hit several obstacles.
Here's one way I thought of:
int[] Function ExtendArray(int[] array) int counter = 0 int[] newArray = new int[array.length + 1] while (counter < array.length) newArray[counter] = array[counter] endWhile return newArrayEndFunction
This gives me the following error:
mismatched input 'array' expecting INTEGER
at the 3rd line. In other words, it doesn't like the fact that I am calling array.length inside the new array's length specification.
WHY!? The Creation Kit tutorial on arrays (which I don't have permission to link to) even shows creating a new array with its length defined as
i * x
. I'm doing the same thing!
On a side note, why don't my code blocks have any syntax highlighting, like the how to ask scripting questions stickied post (which I don't have permission to link to)?
Edit: Now I see that the syntax highlighting doesn't occur in the post preview, while it does once the post is actually posted.