make_array

Byte code
0x14
Operation
Create an array and populate with items on the stack
Format
make_array argc
Stack Before
valuen
...
value2
value1
...
Stack After
[value1, value2, ..., valuen]
...
Description
Creates a new array, populating its contents with the number of items (argc) specified in the opcode. The contents of the new array are taken from the stack, with the top item on the stack becoming the last item in the array. The resulting array is added back to the stack.
Source
  next_int;
  t1 = array_new(state, _int);
  j = _int - 1;
  for(; j >= 0; j--) {
  t2 = stack_pop();
  array_set(state, t1, j, t2);
  }

  cpu_perform_hook(state, c, BASIC_CLASS(array),
  global->sym_from_literal, t1);
  stack_push(t1);