From 753e6955389255854fca8e531ad8c55f3af3023a Mon Sep 17 00:00:00 2001 From: SpookyDervish Date: Sat, 11 Apr 2026 19:57:35 +1000 Subject: [PATCH] made the collections lib use the "any" type --- libs/collections/hashmap.c | 4 ++-- libs/collections/list.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/collections/hashmap.c b/libs/collections/hashmap.c index 7251881..553c19c 100644 --- a/libs/collections/hashmap.c +++ b/libs/collections/hashmap.c @@ -123,8 +123,8 @@ GroundValue createHashmapStruct() { groundAddFieldToStruct(&hashmapStruct, "private_ptr", groundCreateValue(INT, 0)); groundAddFunctionToStruct(&hashmapStruct, "set", hashmapStructSet, INT, 2, STRING, "key", ANY, "value"); // set a key in the hashmap - groundAddFunctionToStruct(&hashmapStruct, "get", hashmapStructGet, INT, 1, STRING, "key"); // get a key in the hashmap, throws KeyNotFound if the key does not exist - groundAddFunctionToStruct(&hashmapStruct, "getOr", hashmapStructGetOr, INT, 2, STRING, "key", ANY, "default"); // get a key in the hashmap, or fallback to a default value + groundAddFunctionToStruct(&hashmapStruct, "get", hashmapStructGet, ANY, 1, STRING, "key"); // get a key in the hashmap, throws KeyNotFound if the key does not exist + groundAddFunctionToStruct(&hashmapStruct, "getOr", hashmapStructGetOr, ANY, 2, STRING, "key", ANY, "default"); // get a key in the hashmap, or fallback to a default value groundAddFunctionToStruct(&hashmapStruct, "remove", hashmapStructRemove, INT, 1, STRING, "key"); // remove a key from the hashmap, throws KeyNotFound if the key does not exist groundAddFunctionToStruct(&hashmapStruct, "removeIfPresent", hashmapStructRemoveIfPresent, BOOL, 1, STRING, "key"); // remove a key from the hashmap, returns true if the key was removed or false if it didn't exist diff --git a/libs/collections/list.c b/libs/collections/list.c index 6eca89c..72fcb50 100644 --- a/libs/collections/list.c +++ b/libs/collections/list.c @@ -456,7 +456,7 @@ GroundValue createListStruct() { groundAddFunctionToStruct(&listStruct, "append", appendToListStruct, INT, 1, ANY, "value"); // append item to end of list groundAddFunctionToStruct(&listStruct, "insert", insertIntoListStruct, INT, 2, ANY, "value", INT, "index"); // insert value at index groundAddFunctionToStruct(&listStruct, "remove", listStructDelete, INT, 1, INT, "index"); // delete value at index - groundAddFunctionToStruct(&listStruct, "at", listStructAt, INT, 1, INT, "index"); // get value at index + groundAddFunctionToStruct(&listStruct, "at", listStructAt, ANY, 1, INT, "index"); // get value at index groundAddFunctionToStruct(&listStruct, "clear", clearListStruct, INT, 0); // clear list groundAddFunctionToStruct(&listStruct, "set", listStructSet, INT, 2, ANY, "value", INT, "index"); // replace a value at an index groundAddFunctionToStruct(&listStruct, "isEmpty", listStructIsEmpty, BOOL, 0); // returns true if list is empty, otherwise false