Clean up hack in `MemoryLuaLibrary.GetMemoryDomainList`
This commit is contained in:
parent
6abed2b052
commit
f3799fbb0e
|
@ -1,4 +1,3 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -18,7 +17,7 @@ namespace BizHawk.Client.Common
|
|||
[LuaMethodExample("local nlmemget = memory.getmemorydomainlist();")]
|
||||
[LuaMethod("getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")]
|
||||
public LuaTable GetMemoryDomainList()
|
||||
=> _th.ListToTable((List<string>) APIs.Memory.GetMemoryDomainList(), indexFrom: 0); //HACK cast will succeed as long as impl. returns .Select<T, string>().ToList() as IROC<string>
|
||||
=> _th.EnumerateToLuaTable(APIs.Memory.GetMemoryDomainList(), indexFrom: 0);
|
||||
|
||||
[LuaMethodExample("local uimemget = memory.getmemorydomainsize( mainmemory.getname( ) );")]
|
||||
[LuaMethod("getmemorydomainsize", "Returns the number of bytes of the specified memory domain. If no domain is specified, or the specified domain doesn't exist, returns the current domain size")]
|
||||
|
|
|
@ -8,6 +8,6 @@ namespace BizHawk.Client.Common
|
|||
public static class LuaExtensions
|
||||
{
|
||||
public static LuaTable EnumerateToLuaTable<T>(this NLuaTableHelper tableHelper, IEnumerable<T> list, int indexFrom = 1)
|
||||
=> tableHelper.ListToTable(list.ToList(), indexFrom);
|
||||
=> tableHelper.ListToTable(list as IReadOnlyList<T> ?? list.ToList(), indexFrom);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue