I'm just wondering: if I set a variable to have 1 array, will it have only Var[0], or will it have Var[0]
and Var[1] ?
Post has been edited 1 time(s), last time on Jan 3 2011, 5:59 pm by payne.
None.
An artist's depiction of an Extended Unit Death
I believe setting the array size in Galaxy includes the index of the array length, which is kind of dumb because it doesn't work like that for any language of which I am aware.
So it would have Var[0] and Var[1].
If you try to set an index out of bounds directly, Galaxy will change it to the last index in the array. For example, if you tried putting Var[2], the editor will recognize it as out of bounds and set it to Var[1] when you hit "Ok."
Having an array of size 1 doesn't make sense, anyway; you would just have a normal variable.
Having an array of size 1 doesn't make sense, anyway; you would just have a normal variable.
Based on what you're saying, array size of 1 gives a variable 2 arrays, and it would thus not be just a normal variable. ;o
None.
I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.
When you define the array (the variable), you define the length/size (together with data type).
example:
If you define an integer myArrayVariable[1], you will only have myArrayVariable[0] existing.
If you define an integer myArrayVariable[10], you will have myArrayVariable[0, 1, 2, 3, ..., 7, 8, 9] existing.edit:
this is wrong. next post is the correct answer.
Post has been edited 1 time(s), last time on Jan 2 2011, 11:05 pm by Ahli.
An artist's depiction of an Extended Unit Death
When you define the array (the variable), you define the length/size (together with data type).
example:
If you define an integer myArrayVariable[1], you will only have myArrayVariable[0] existing.
If you define an integer myArrayVariable[10], you will have myArrayVariable[0, 1, 2, 3, ..., 7, 8, 9] existing.
In most languages, this is the case. This is
wrong for Galaxy. myArrayVariable[10] ranges from 0 to 10, and the actual array length would be 11.
Having an array of size 1 doesn't make sense, anyway; you would just have a normal variable.
Based on what you're saying, array size of 1 gives a variable 2 arrays, and it would thus not be just a normal variable. ;o
Yeah, I'm saying that if you wanted an array of size 1, you should just make a non-array variable. The smallest array you can have in Galaxy will be of size 2 (index 0 and index 1).
I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.
When you define the array (the variable), you define the length/size (together with data type).
example:
If you define an integer myArrayVariable[1], you will only have myArrayVariable[0] existing.
If you define an integer myArrayVariable[10], you will have myArrayVariable[0, 1, 2, 3, ..., 7, 8, 9] existing.
In most languages, this is the case. This is
wrong for Galaxy. myArrayVariable[10] ranges from 0 to 10, and the actual array length would be 11.
My mind just blew up?!
ok, so now I'm stopping to waste space ;D
So if I have 2 arrays for a variable, it'll create Var[0], [1], and [2], thus letting me use [Triggering Player] ?
So
this is wrong?
None.
An artist's depiction of an Extended Unit Death
So if I have 2 arrays for a variable, it'll create Var[0], [1], and [2], thus letting me use [Triggering Player] ?
Two arrays? A multi-dimensional array, you mean? Or an array of size 2? If it's an array of size 2, then yes, it will have Var[0], Var[1] and Var[2]. You can use (Triggering Player) or any other integer function. Of course, you'll have to watch for out-of-bounds exceptions when doing this.
Yes, it is inaccurate. It's making the assumption that Galaxy's arrays work like arrays from other programming languages.