トピック
Jaxon SuperJax

PUSH and MxN Arrays

I'm aware of PUSH along with its counterparts and how they work with single dimensional arrays. VAR Foo[0] PUSH Foo, 3 PUSH Foo, 999 etc. Is it possible to PUSH (and POP) a multidimensional array? ie: VAR Foo[0,2] VAR bar[2]: bar[0]=111: bar[1]=444 PUSH Foo, bar
0そうだね
プレイ済み
返信[1]
親投稿
Jaxon SuperJax
To clarify my question: I'm looking for a syntactically correct way to do it if it's possible.
0そうだね
プレイ済み
返信[2]
親投稿
calc84 calc84maniac
I'm afraid it's not possible to resize a multi-dimensional array at all. However, it may be possible to make a function that creates a new array of the correct size and then uses COPY to fill it with the old array and the new values. Either that, or use a one-dimensional array and COPY to the end of it (but you'd have to do the index calculations yourself).
0そうだね
プレイ済み
返信[3]
親投稿
Jaxon SuperJax
@calc84 Thanks. I ended up going with a single dimensional array and calculating the index. I'm using the first element as the length so my get ends up as arr[1+(y*W+x)]
0そうだね
プレイ済み
返信[4]
親投稿
calc84 calc84maniac
You can use the LEN function to get the length of the array, so you don't have to keep track of it yourself.
0そうだね
プレイ済み
返信[5]
親投稿
Jaxon SuperJax
I though about that. My intent was to keep track of the rows in the 2-d array. I suppose I could have just divided the LEN by 2
0そうだね
プレイ済み