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

Go to the source code of this file.
Functions | |
| if (arr.type !=VAL_ARRAY) | |
| free_value (arr) | |
| push_value (vm, make_int(0)) | |
Variables | |
| case | OP_CLEAR |
| array_clear & | arr |
| break | |
Implements the OP_CLEAR opcode for clearing arrays in the VM.
Handles the OP_CLEAR instruction, which removes all elements from an array. The array is popped from the stack; the opcode pushes an integer result (currently 0) as an acknowledgement.
Behavior:
Error Handling:
Example: // Bytecode: OP_CLEAR // Stack before: [[10, 20, 30]] // Stack after: [0]
Definition in file clear.c.
| free_value | ( | arr | ) |
| push_value | ( | vm | , |
| make_int(0) | ) |
| array_clear& arr |