diff --git a/include/groundvm.h b/include/groundvm.h index 24ec574..4c52f18 100644 --- a/include/groundvm.h +++ b/include/groundvm.h @@ -208,6 +208,8 @@ GroundProgram groundParseFile(const char* code); GroundStruct groundCreateStruct(); void groundAddFieldToStruct(GroundStruct* gstruct, char* name, GroundValue field); +GroundObjectField* groundFindField(GroundObject head, const char *id); + // Run function returned by Ground code // Use argc to set count of args, accepts that amount of GroundValue's after GroundValue groundRunFunction(GroundFunction* function, size_t argc, ...); diff --git a/src/interface.c b/src/interface.c index b5d58bb..544eef2 100644 --- a/src/interface.c +++ b/src/interface.c @@ -180,3 +180,9 @@ GroundValue groundRunFunction(GroundFunction* function, size_t argc, ...) { return interpretGroundProgram(&function->program, &callScope); } + +GroundObjectField* groundFindField(GroundObject head, const char *id) { + GroundObjectField* s; + HASH_FIND_STR(head.fields, id, s); + return s; +}