added cosmoV_error

This commit is contained in:
2020-11-13 12:54:06 -06:00
parent 08b6dcbf4c
commit 71d3a8e1c4
3 changed files with 18 additions and 11 deletions

View File

@@ -26,11 +26,17 @@ CValue cosmoB_dsetMeta(CState *state, int nargs, CValue *args) {
CObjObject *meta = cosmoV_readObject(args[1]);
obj->meta = meta; // boom done
}
} else {
cosmoV_error(state, "Expected 2 parameters, got %d!", nargs);
}
return cosmoV_newNil(); // nothing
}
CValue cosmoB_dgetMeta(CState *state, int nargs, CValue *args) {
if (nargs != 1) {
cosmoV_error(state, "Expected 1 parameter, got %d!", nargs);
}
return cosmoV_newObj(cosmoV_readObject(args[0])->meta); // just return the meta
}