Skip to content

Commit 7e3993b

Browse files
authored
Update vm.c
1 parent 2bbb01e commit 7e3993b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,10 @@ bool values_equal(Value a, Value b) {
123123
default: return false;
124124
}
125125
}
126+
127+
Value peek(int offset) {
128+
if (vm.stack_top - offset - 1 < 0) {
129+
panic("Stack underflow!");
130+
}
131+
return vm.stack[vm.stack_top - offset - 1];
132+
}

0 commit comments

Comments
 (0)