トピック
Zee Storybookten9

Is there a way to get the length of a SPECIFIC DIMENSION in an array? So like LEN(hi,1) or whatever it is (I'm 99% sure it's not that).

1そうだね
プレイ済み
返信[1]
親投稿
OlOOlOOl pi_r_round
Not that I'm aware of. :( Perhaps, during creation you could store it in a variable? Otherwise maybe you could DIM it one larger than it needs to be, store some sort of end-of-data as the last value, then at a future point, walk through the array until you find that value?
2そうだね
プレイ済み
返信[2]
親投稿
OlOOlOOl pi_r_round
Another idea is to DIM it one larger than it needs to be and store the lengths in the first elements. So, if you require a 5 x 10 array, instead of DIM A[5,10], use DIM A[6,11], then store the real data in [1,1] through [5,10], and store the size of the first dimension (5) in [0,1], and the size of the second dimension (10) in [1,0]. Yes, for larger arrays it'll result lots of wasted memory.
1そうだね
プレイ済み
返信[3]
親投稿
Zee Storybookten9
Hmm... Ok. I guess I'll just have an array for the sizes of an array. That way it won't waste too much memory.
0そうだね
プレイ済み
返信[4]
親投稿
Zee Storybookten9
Okay, second array question: is there a way to PUSH values into a 2 dimensional array (like PUSH HI,[5,2] but that's not it I've tried)?
0そうだね
プレイ済み
返信[5]
親投稿
OlOOlOOl pi_r_round
I believe all the array commands like that work only on 1-dimensional arrays.
0そうだね
プレイ済み
返信[6]
親投稿
Jaxon SuperJax
I asked the PUSH question last week or so. The short answer is no. However, you can take a single dimensional array and treat in as any NxM array. https://miiverse.nintendo.net/posts/AYMHAAACAAADVHkmVSs_Bg
0そうだね
プレイ済み
返信[7]
親投稿
Zee Storybookten9
Ok, already found a work-around lol. Specific to what I'm doing, but hopefully won't need it otherwise.
0そうだね
プレイ済み