# Can someone make a 2d array extension?

**URL:** <https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456>\
**Category:** Help\
**Created:** [January 9, 2021, 10:55pm UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456 "2021-01-09T22:55:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [January 9, 2021, 10:55pm UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456/1 "2021-01-09T22:55:02Z")

</div>

I don’t usually ask people to make a whole project for me, but I had trouble with this. I want a small extension that has the following blocks:

A way to set an array:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/a/a0a5ce26210c8174b128ae3fee8098f5bdbeed1f.png)  
Or any other way. (sorry for the bad drawing)

A way to add columns and rows to the beginning or end.

A way to set a value to something else.

That’s it!

If you make it, thanks a lot!

Also,  
Can it be so that you can’t add individual cells, but only columns and rows?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/fd14982766411d68fb1aa20078e36e5de76bc50f.png)

Thanks again!

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [January 9, 2021, 11:15pm UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456/2 "2021-01-09T23:15:26Z")

</div>

You can have nested arrays:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/2cadc0c4f7c795c2822bd0e0314e83e9adc6e660.png)  
And you can access them like this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/09dbe71e4d4b86143eda1b4ec132d7ead5613ba7.png)  
And do whatever you normally would do with regular arrays.

Note that you cannot have a blank array of arrays:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/ea048ecc73c26652cc44058f4827f8901addb1f8.png)  
Because the type checker wouldn’t know what type it is.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [January 9, 2021, 11:58pm UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456/3 "2021-01-09T23:58:22Z")

</div>

I know of this, but when I try to do things like this, It produces many errors.

---

<div class="post-metadata">

**Author:** ![shiba-jp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shiba-jp/32/2879_2.png) [@shiba-jp](https://forum.makecode.com/u/shiba-jp)\
**Post date:** [January 10, 2021, 2:43am UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456/4 "2021-01-10T02:43:32Z")

</div>

In my case, I first initialize a two-dimensional array, and then store the values there.

```auto
let putCardMap: number[][] = null

putCardMap = [[],[]]

//Init Map
for(let i = 0; i < 5; i++) {
    putCardMap[i] = []
    for(let j = 0; j < 5; j++) {
        putCardMap[i][j] = null
    }
 }

//set value
putCardMap[posX][posY] = currentCardNo

```

> **[Poker solitaire](https://arcade.makecode.com/55477-11811-97385-94254)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [January 10, 2021, 2:43am UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456/5 "2021-01-10T02:43:46Z")

</div>

Could you share the project that errors out a lot? I do this alot.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [January 10, 2021, 5:24am UTC](https://forum.makecode.com/t/can-someone-make-a-2d-array-extension/5456/6 "2021-01-10T05:24:42Z")

</div>

> [@Otherworldly](https://forum.makecode.com/t/otherworldly/5314):
>
> I will post updates for my game, “Otherworldly”, here. Latest update (1.2) Update features - mining land generation infinite land tree generation Game - Next Update - generating chunks below and above the top chunk lair

Here!
