![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_REMOVE opcode for removing elements from arrays in the VM. More...

Go to the source code of this file.
Functions | |
| if (arr.type !=VAL_ARRAY||idx.type !=VAL_INT) | |
| if (!array_remove(&arr,(int) idx.i, &out)) | |
| free_value (arr) | |
| free_value (idx) | |
| push_value (vm, out) | |
Variables | |
| case | OP_REMOVE |
| Value | arr = pop_value(vm) |
| Value | out |
| break | |
Implements the OP_REMOVE opcode for removing elements from arrays in the VM.
Handles the OP_REMOVE instruction, which removes an element from an array at the specified index. The array and index are popped from the stack; the removed element is pushed back onto the stack.
Behavior:
Error Handling:
Example: // Bytecode: OP_REMOVE // Stack before: [1, [10, 20, 30]] // Stack after: [20]
Definition in file remove.c.
| free_value | ( | arr | ) |
| free_value | ( | idx | ) |
| if | ( | !array_remove(&, intidx. | i, |
| & | out ) |
| push_value | ( | vm | , |
| out | ) |