add vclear

This commit is contained in:
Rongsong Shen 2026-02-14 16:31:09 +08:00
parent 30f7f4475f
commit 277bc31225
2 changed files with 25 additions and 0 deletions

View file

@ -64,3 +64,26 @@ int vput(var v, int idx, void* data)
return method(obj, idx, data);
}
void vclear(var v)
{
meta_obj_t* obj = NULL;
vclear_fn_t method = NULL;
obj = RTTI_DATA_TO_OBJ(v);
if (RTTI_OBJ_INVALID(obj)) {
errno = EINVAL;
return;
}
RTTI_GET_METHOD(method, obj, varray, vclear);
if (method == NULL) {
errno = EINVAL;
return;
}
method(obj);
return;
}