diff options
author | ubq323 <ubq323@ubq323.website> | 2024-07-02 17:17:01 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-07-02 17:17:01 +0100 |
commit | 033a9cbb66d65a0918e2c095d12937afb82fd4b2 (patch) | |
tree | 29d5314ff15aa677b732d2631d555c2a6b1d942d /vm.c | |
parent | 6e8123763241efcb259f68d6e0e6d3ffcbc32795 (diff) |
add (each (x arr) ...) array-loop form
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -274,6 +274,13 @@ int runvm(State *S) { objarr_append(S, arr, v); break; } + case OP_ARRLEN: { + Val v = POP(); + CHECK(IS_ARR(v), "can only get length of array"); + ObjArr *arr = AS_ARR(v); + PUSH(VAL_NUM(arr->len)); + break; + } default: ERROR("unknown opcode"); |