![]() |
Fun 0.41.5
The programming language that makes you have fun!
|
Implements the OP_INSERT opcode for inserting elements into arrays in the VM. More...
Go to the source code of this file.
Functions | |
| if (arr.type !=VAL_ARRAY||idx.type !=VAL_INT) | |
| if (n< 0) | |
| free_value (arr) | |
| free_value (idx) | |
| push_value (vm, make_int(n)) | |
Variables | |
| case | OP_INSERT |
| Value | idx = pop_value(vm) |
| Value | arr = pop_value(vm) |
| int | n = array_insert(&arr, (int)idx.i, v) |
| break | |
Implements the OP_INSERT opcode for inserting elements into arrays in the VM.
This file handles the OP_INSERT instruction, which inserts a value into an array at a specified index. The array, index, and value are popped from the stack, and the new length of the array is pushed back onto the stack.
Behavior:
Error Handling:
Example:
Definition in file insert.c.
| free_value | ( | arr | ) |
| free_value | ( | idx | ) |
| int n = array_insert(&arr, (int)idx.i, v) |