![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_SET opcode for setting elements in 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_set(&arr,(int) idx.i, v)) | |
| free_value (arr) | |
| free_value (idx) | |
| push_value (vm, copy_value(&v)) | |
| free_value (v) | |
Variables | |
| case | OP_SET |
| Value | idx = pop_value(vm) |
| Value | arr = pop_value(vm) |
| break | |
Implements the OP_SET opcode for setting elements in arrays in the VM.
Handles the OP_SET instruction, which sets a value at a specified index in an array. The value, index, and array are popped from the stack; the value is returned back on the stack (as a copy) to mirror expression semantics.
Behavior:
Error Handling:
Example: // Bytecode: OP_SET // Stack before: [42, 1, [10, 20, 30]] // Stack after: [42]
Definition in file set.c.
| free_value | ( | arr | ) |
| free_value | ( | idx | ) |
| free_value | ( | v | ) |
| push_value | ( | vm | , |
| copy_value & | v ) |