mirror of
https://github.com/CPunch/Cosmo.git
synced 2025-12-05 13:00:46 +00:00
refactored cosmoV_set & cosmoV_get, renamed COSMO_TOBJ->COSMO_TREF
also changed print() to print raw primitives instead of generating a <string> needlessly. helped performance immensely in scripts like `examples/increment.cosmo`
This commit is contained in:
16
src/cvm.h
16
src/cvm.h
@@ -40,8 +40,20 @@ COSMO_API bool cosmoV_registerProtoObject(CState *state, CObjType objType, CObjO
|
||||
*/
|
||||
COSMO_API bool cosmoV_compileString(CState *state, const char *src, const char *name);
|
||||
|
||||
COSMO_API bool cosmoV_get(CState *state, CObj *obj, CValue key, CValue *val);
|
||||
COSMO_API bool cosmoV_set(CState *state, CObj *obj, CValue key, CValue val);
|
||||
/*
|
||||
expects object to be pushed, then the key.
|
||||
|
||||
if returns false an error was thrown, if returns true the value was pushed onto the stack and the object and key were popped
|
||||
*/
|
||||
COSMO_API bool cosmoV_get(CState *state);
|
||||
|
||||
/*
|
||||
expects object to be pushed, then the key, and finally the new value.
|
||||
|
||||
if returns false an error was thrown, if returns true the value was set and the object key, and value were popped
|
||||
*/
|
||||
COSMO_API bool cosmoV_set(CState *state);
|
||||
|
||||
// wraps the closure into a CObjMethod, so the function is called as an invoked method
|
||||
COSMO_API bool cosmoV_getMethod(CState *state, CObj *obj, CValue key, CValue *val);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user