![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_SLICE opcode for array slicing in the VM. More...

Go to the source code of this file.
Functions | |
| if (arr.type !=VAL_ARRAY||start.type !=VAL_INT||end.type !=VAL_INT) | |
| free_value (arr) | |
| free_value (start) | |
| free_value (end) | |
| push_value (vm, out) | |
Variables | |
| case | OP_SLICE |
| Value | start = pop_value(vm) |
| Value | arr = pop_value(vm) |
| Value | out = array_slice(&arr, (int)start.i, (int)end.i) |
| break | |
Implements the OP_SLICE opcode for array slicing in the VM.
This file handles the OP_SLICE instruction, which creates a new array containing elements from the original array between specified start and end indices.
Behavior:
Error Handling:
Example: // Bytecode: OP_SLICE // Stack before: [3, 1, [10,20,30,40]] // Stack after: [[20,30]]
Definition in file slice.c.
| free_value | ( | arr | ) |
| free_value | ( | end | ) |
| free_value | ( | start | ) |
| push_value | ( | vm | , |
| out | ) |
| Value out = array_slice(&arr, (int)start.i, (int)end.i) |