From 15e3cbbb68e9ba25774bcf1f4bb33151d0021f08 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 10 Feb 2024 10:23:20 +0100 Subject: [PATCH] Add documentation to JSON loading functions --- include/openspace/util/json_helper.h | 4 +++- src/engine/openspaceengine_lua.inl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/openspace/util/json_helper.h b/include/openspace/util/json_helper.h index 8d089cdee2..00e5f62b6c 100644 --- a/include/openspace/util/json_helper.h +++ b/include/openspace/util/json_helper.h @@ -76,7 +76,9 @@ std::string formatJson(T value); void sortJson(nlohmann::json& json, const std::string& key); /** - * Converts the provided JSON object into its corresponding Dictionary format. + * Converts the provided JSON object into its corresponding Dictionary format. Please note + * that if the JSON contains keys that array of an array type, they are converted into a + * Dictionary with numerical keys and the numerical keys start with 1. */ ghoul::Dictionary jsonToDictionary(const nlohmann::json& json); diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 43a85dabc7..128133a9f0 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -252,7 +252,9 @@ namespace { } /** - * Loads the provided JSON file and returns it back to the caller. + * Loads the provided JSON file and returns it back to the caller. Please note that if the + * JSON contains keys that array of an array type, they are converted into a Dictionary + * with numerical keys and the numerical keys start with 1. */ [[codegen::luawrap]] ghoul::Dictionary loadJson(std::filesystem::path path) { if (!std::filesystem::exists(path)) {