diff options
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"); |