Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Using .length attribute with 2d array

Author
Message
Zandy
2
Years of Service
User Offline
Joined: 26th Nov 2021
Playing:
Posted: 12th Apr 2023 17:06
How can i allow for dynamic resizing of rows and columns in a multidimensional array, utilizing the .length attribute?

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Apr 2023 21:27 Edited at: 13th Apr 2023 22:23
This post has been marked by the post author as the answer.
array.length = value // Changes the number of rows
array[1].length = value // changes the number of columns for row 1

Note that you cannot change the number of columns if the row doesn't exist
array.length = 1
array[2].length = 3 // This will fail because row 2 doesn't exist
Zandy
2
Years of Service
User Offline
Joined: 26th Nov 2021
Playing:
Posted: 13th Apr 2023 13:17
Thankyou sir

Login to post a reply

Server time is: 2024-11-21 12:30:57
Your offset time is: 2024-11-21 12:30:57