removed printStack() from cosmoB_pcall()

This commit is contained in:
CPunch 2021-01-05 22:46:04 -06:00
parent eb2f50e456
commit 860f30f201
2 changed files with 8 additions and 3 deletions

View File

@ -54,7 +54,6 @@ int cosmoB_pcall(CState *state, int nargs, CValue *args) {
// insert false before the result // insert false before the result
cosmo_insert(state, 0, cosmoV_newBoolean(res == COSMOVM_OK)); cosmo_insert(state, 0, cosmoV_newBoolean(res == COSMOVM_OK));
cosmoV_printStack(state);
return 2; return 2;
} }

View File

@ -339,9 +339,15 @@ COSMOVMRESULT cosmoV_pcall(CState *state, int args, int nresults) {
if (!callCValue(state, *base, args, nresults, 0)) { if (!callCValue(state, *base, args, nresults, 0)) {
// restore panic state // restore panic state
state->panic = false; state->panic = false;
state->error = NULL;
cosmoV_pushValue(state, cosmoV_newObj(state->error)); if (nresults > 0) {
cosmoV_pushValue(state, cosmoV_newObj(state->error));
// push other expected results onto the stack
for (int i = 0; i < nresults-1; i++)
cosmoV_pushValue(state, cosmoV_newNil());
}
return COSMOVM_RUNTIME_ERR; return COSMOVM_RUNTIME_ERR;
} }