feat: add exit builtin function

This commit is contained in:
samsonium
2026-10-18 18:41:49 +03:00
parent f0e641928d
commit c0df5fc9d4
3 changed files with 35 additions and 4 deletions
+6 -1
View File
@@ -538,8 +538,8 @@ int fzl_vm_run(fzl_vm_t *vm)
return -1;
}
fzl_value_t llt = vm->dstack[--vm->dtop];
fzl_value_t rlt = vm->dstack[--vm->dtop];
fzl_value_t llt = vm->dstack[--vm->dtop];
vm->dstack[vm->dtop++] =
(fzl_value_t){.type = FZL_TYPE_BOOL, .as.b = llt.as.u < rlt.as.u};
break;
@@ -769,6 +769,11 @@ int fzl_vm_run(fzl_vm_t *vm)
else if (arg.type == FZL_TYPE_OBJECT)
print_object(arg.as.obj);
}
else if (fn_id == FZL_BUILTIN_EXIT)
{
fzl_value_t arg = vm->dstack[--vm->dtop];
exit(arg.as.i);
}
else
{
snprintf(last_err, sizeof(last_err),