Added CObj->proto support, state->protoObjects defines default protos for each COBJ type

a lot of refactoring in the VM
This commit is contained in:
2021-01-07 19:50:36 -06:00
parent c5bd0c2478
commit 1351ff63b1
9 changed files with 195 additions and 150 deletions

View File

@@ -32,7 +32,6 @@ CState *cosmoV_newState() {
state->frameCount = 0;
state->openUpvalues = NULL;
state->protoObj = NULL;
state->error = NULL;
cosmoT_initTable(state, &state->strings, 8); // init string table
@@ -62,6 +61,10 @@ CState *cosmoV_newState() {
// set the IString flags
for (int i = 0; i < ISTRING_MAX; i++)
state->iStrings[i]->isIString = true;
// set default proto objects
for (int i = 0; i < COBJ_MAX; i++)
state->protoObjects[i] = NULL;
return state;
}