Refactored cosmoO_equals

This sets up room for the '__equal' metamethod to be added

- cosmoO_equals now requires the state to be passed
- cosmoV_equals now requires the state to be passed
- cosmoT_get now requires the state to be passed
This commit is contained in:
2021-02-19 17:04:23 -06:00
parent 40739e9bea
commit 3890c9dd1e
11 changed files with 58 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ void freeChunk(CState* state, CChunk *chunk) {
int addConstant(CState* state, CChunk *chunk, CValue value) {
// before adding the constant, check if we already have it
for (size_t i = 0; i < chunk->constants.count; i++) {
if (cosmoV_equal(value, chunk->constants.values[i]))
if (cosmoV_equal(state, value, chunk->constants.values[i]))
return i; // we already have a matching constant!
}