The Croc Programming Language
Arrays

Functions

word_t croc_array_new (CrocThread *t, uword_t len)
 
word_t croc_array_newFromStack (CrocThread *t, uword_t len)
 
void croc_array_fill (CrocThread *t, word_t arr)
 

Detailed Description

Functions which operate on arrays.

Function Documentation

word_t croc_array_new ( CrocThread t,
uword_t  len 
)

Creates a new array object and pushes it onto the stack.

Parameters
lenis how long the new array should be. It will be filled with null.
Returns
the stack index of the pushed value.
word_t croc_array_newFromStack ( CrocThread t,
uword_t  len 
)

Creates a new array object using values on top of the stack to fill it.

This pops the values, and pushes the new array.

Parameters
lenis how long the array will be. There should be this many values sitting on top of the stack.
Returns
the stack index of the pushed value.
void croc_array_fill ( CrocThread t,
word_t  arr 
)

Fills every slot of the array at slot arr with the value on top of the stack, and then pops that value.