From 6fecf42e0e7f6107e4957ab5ada6a4b31a75680c Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Sat, 14 Mar 2026 14:10:51 +1100 Subject: [PATCH] Add groundFindField to groundvm.h --- include/groundvm.h | 2 ++ src/interface.c | 6 ++++++ 2 files changed, 8 insertions(+) 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; +}