From f43d2fb98e82a5a91f59a1b815bf1e733308039c Mon Sep 17 00:00:00 2001 From: Gustas Date: Tue, 15 Oct 2024 16:10:34 +0300 Subject: [PATCH] Fix lua failing to translate strings with arguments --- OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs index ee10f4d643..8ae845e8d3 100644 --- a/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs @@ -9,7 +9,6 @@ */ #endregion -using System.Collections.Generic; using Eluant; using OpenRA.Mods.Common.Widgets; using OpenRA.Primitives; @@ -40,7 +39,8 @@ namespace OpenRA.Mods.Common.Scripting.Global { if (args != null) { - var argumentDictionary = new Dictionary(); + var argumentDictionary = new object[args.Count * 2]; + var i = 0; foreach (var kv in args) { using (kv.Key) @@ -51,7 +51,8 @@ namespace OpenRA.Mods.Common.Scripting.Global "String arguments requires a table of [\"string\"]=value pairs. " + $"Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}"); - argumentDictionary.Add(variable, value); + argumentDictionary[i++] = variable; + argumentDictionary[i++] = value; } }