Improve how simple (number-indexed) Lua tables are printed
also might change sort order for associative tables in some edge cases
This commit is contained in:
parent
b6bcd083a3
commit
631e5c37b4
|
@ -69,7 +69,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
var entries = ((IEnumerator<KeyValuePair<object, object/*?*/>>) lti.GetEnumerator()).AsEnumerable()
|
var entries = ((IEnumerator<KeyValuePair<object, object/*?*/>>) lti.GetEnumerator()).AsEnumerable()
|
||||||
.ToArray();
|
.ToArray();
|
||||||
return string.Concat(entries.Select(static kvp => $"\"{kvp.Key}\": \"{kvp.Value}\"\n").Order());
|
Console.WriteLine(entries[0].Key.GetType().FullName);
|
||||||
|
return string.Concat(entries.All(static kvp => kvp.Key is long)
|
||||||
|
? entries.OrderBy(static kvp => (long) kvp.Key, Comparer<long>.Default)
|
||||||
|
.Select(static kvp => $"{kvp.Key}: \"{kvp.Value}\"\n")
|
||||||
|
: entries.OrderBy(static kvp => kvp.Key)
|
||||||
|
.Select(static kvp => $"\"{kvp.Key}\": \"{kvp.Value}\"\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Tools.Has<LuaConsole>())
|
if (!Tools.Has<LuaConsole>())
|
||||||
|
|
Loading…
Reference in New Issue