diff --git a/src/env.c b/src/env.c index a74d1e4..5265d65 100644 --- a/src/env.c +++ b/src/env.c @@ -410,6 +410,14 @@ Object help(Object* params, int length, struct Environment* env) return text; } } + Object* object = fetch(symbol, env); + if (object) { + size_t len; + char* string = stringObj(object, &len); + Object text = stringFromSlice(string, len); + free(string); + return text; + } return nullTerminated("Help not found!"); } diff --git a/src/object.h b/src/object.h index 83e615d..5a2ce86 100644 --- a/src/object.h +++ b/src/object.h @@ -106,7 +106,10 @@ struct Object { #endif }; - Object* forward; + union { + Object* forward; + char* docString; + }; }; struct StructDef {