Simplify `SerializeTable` in `ConsoleLuaLibrary` further

see b6bcd083a
This commit is contained in:
YoshiRulz 2025-06-17 03:39:03 +10:00
parent 701ef1e960
commit f3b19b8d27
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 1 additions and 2 deletions

View File

@ -67,8 +67,7 @@ namespace BizHawk.Client.EmuHawk
{
static string SerializeTable(LuaTable lti)
{
var entries = ((IEnumerator<KeyValuePair<object, object/*?*/>>) lti.GetEnumerator()).AsEnumerable()
.ToArray();
var entries = lti.ToArray();
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")