Product Site

5.3.6.1. new (Class Method)

Returns a new empty array. If you specify any size arguments, the size is taken as a hint about how big each dimension should be. The Array class uses this only to allocate the initial array object. For multi-dimensional Arrays, you can also specify how much space is to be allocated initially for each dimension of the array.

Each size argument must a non-negative whole number. If it is 0, the corresponding dimension is initially empty. The dimensions may also be specified with one single-dimensional Array of sizes.
Example 5.163. Array class — of method
   a = .array~new()        -- create a new, empty array
   a = .array~new(3,3)     -- create a new 3x3 array
   sizes = .array~of(4,4,4)
   a = .array~new(sizes)   -- create new 4x4x4 array