Fix lua failing to translate strings with arguments

This commit is contained in:
Gustas
2024-10-15 16:10:34 +03:00
committed by Paul Chote
parent fb55764887
commit f43d2fb98e

View File

@@ -9,7 +9,6 @@
*/ */
#endregion #endregion
using System.Collections.Generic;
using Eluant; using Eluant;
using OpenRA.Mods.Common.Widgets; using OpenRA.Mods.Common.Widgets;
using OpenRA.Primitives; using OpenRA.Primitives;
@@ -40,7 +39,8 @@ namespace OpenRA.Mods.Common.Scripting.Global
{ {
if (args != null) if (args != null)
{ {
var argumentDictionary = new Dictionary<string, object>(); var argumentDictionary = new object[args.Count * 2];
var i = 0;
foreach (var kv in args) foreach (var kv in args)
{ {
using (kv.Key) using (kv.Key)
@@ -51,7 +51,8 @@ namespace OpenRA.Mods.Common.Scripting.Global
"String arguments requires a table of [\"string\"]=value pairs. " + "String arguments requires a table of [\"string\"]=value pairs. " +
$"Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}"); $"Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}");
argumentDictionary.Add(variable, value); argumentDictionary[i++] = variable;
argumentDictionary[i++] = value;
} }
} }