diff --git a/src/cobj.c b/src/cobj.c index bd6fc01..8daa5ba 100644 --- a/src/cobj.c +++ b/src/cobj.c @@ -250,6 +250,14 @@ void cosmoO_setObject(CState *state, CObjObject *object, CValue key, CValue val) } } +void cosmoO_setUserData(CState *state, CObjObject *object, void *p) { + object->user = p; +} + +void *cosmoO_getUserData(CState *state, CObjObject *object) { + return object->user; +} + bool cosmoO_getIString(CState *state, CObjObject *object, int flag, CValue *val) { if (readFlag(object->istringFlags, flag)) return false; // it's been cached as bad diff --git a/src/cobj.h b/src/cobj.h index a3c365c..b5905ef 100644 --- a/src/cobj.h +++ b/src/cobj.h @@ -118,6 +118,9 @@ CObjUpval *cosmoO_newUpvalue(CState *state, CValue *val); bool cosmoO_getObject(CState *state, CObjObject *object, CValue key, CValue *val); void cosmoO_setObject(CState *state, CObjObject *object, CValue key, CValue val); +void cosmoO_setUserData(CState *state, CObjObject *object, void *p); +void *cosmoO_getUserData(CState *state, CObjObject *object); + // internal string bool cosmoO_getIString(CState *state, CObjObject *object, int flag, CValue *val);