From 2b4a7da3471254552bd46489cdf467e7b977c072 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Wed, 15 May 2024 21:16:28 +0200 Subject: [PATCH] Add list_categories() --- README.md | 2 ++ src/modules/splashes.gd | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 025b912..8be0e9b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ Adds a splash to the specified category. Adds an array of splashes to the specified category. #### *CoreBaseModule* delete_category(*String* category) Removes the specified category. +#### *Array[String]* get_categories()() +Returns a list of all categories. #### *CoreBaseModule* copy_splashes(*String* source_category, *String* target_category) Copies all splashes from the source category to the target category. #### *String* get_random_splash(*String* category) diff --git a/src/modules/splashes.gd b/src/modules/splashes.gd index e84db83..2ae5671 100644 --- a/src/modules/splashes.gd +++ b/src/modules/splashes.gd @@ -139,6 +139,10 @@ func add_splashes(category: String, splash_array: Array[String]) -> CoreBaseModu return self +## Returns a list of all categories. +func list_categories() -> Array[String]: + return core.misc.array_to_stringarray(splashes.keys()) + ## Removes the specified category. func delete_category(category: String) -> CoreBaseModule: splashes.erase(category)