Filling Array2D Error

I am trying to use the Array2D for the first time. I thought using it should be as easy as

Array2D.fill(4, {0})

But this gives the following Error:

ERROR: 'add' should have been implemented by Array2D.
RECEIVER: Array2D[ [ nil ][ nil ][ nil ][ nil ] ]

yep .fill is not implemented for Array2D…

I’d suggest an array of arrays:

for a 4 x 4 artray of zeros:

Array.fill([4,4],0)

or even:

0 ! [4,4]

access like ~myArray[x][y]

see J concepts in SC | SuperCollider 3.12.2 Help for more

1 Like