From 9fee51551cb97ea33a07c988e6e853ff6e6ffc3c Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 26 Apr 2025 18:49:03 +0200 Subject: [PATCH] Add support for comment content in LuaTable.Create method --- app/SharedTools/LuaTable.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/SharedTools/LuaTable.cs b/app/SharedTools/LuaTable.cs index ace1c965..16d092b4 100644 --- a/app/SharedTools/LuaTable.cs +++ b/app/SharedTools/LuaTable.cs @@ -4,7 +4,7 @@ namespace SharedTools; public static class LuaTable { - public static string Create(ref StringBuilder sb, string tableVariableName, IReadOnlyDictionary keyValuePairs, CancellationToken cancellationToken = default) + public static string Create(ref StringBuilder sb, string tableVariableName, IReadOnlyDictionary keyValuePairs, IReadOnlyDictionary? commentContent = null, CancellationToken cancellationToken = default) { // // Add the UI_TEXT_CONTENT table: @@ -17,6 +17,7 @@ public static class LuaTable var key = kvp.Key; var value = kvp.Value.Replace("\n", " ").Trim(); + var commentValue = commentContent is null ? value : commentContent.GetValueOrDefault(key, value); // Remove the "UI_TEXT_CONTENT." prefix from the key: const string UI_TEXT_CONTENT = "UI_TEXT_CONTENT."; @@ -27,7 +28,7 @@ public static class LuaTable // Add a comment with the original text content: sb.AppendLine(); - sb.AppendLine($"-- {value}"); + sb.AppendLine($"-- {commentContent}"); // Add the assignment to the UI_TEXT_CONTENT table: sb.AppendLine($"""