2017-04-14 19:59:01 +00:00
|
|
|
|
using LuaInterface;
|
2015-04-10 14:11:01 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
|
|
|
|
public static class LuaHelper
|
|
|
|
|
{
|
|
|
|
|
public static LuaTable ToLuaTable(Lua lua, object obj)
|
|
|
|
|
{
|
|
|
|
|
var table = lua.NewTable();
|
|
|
|
|
|
|
|
|
|
var type = obj.GetType();
|
|
|
|
|
|
|
|
|
|
var methods = type.GetMethods();
|
|
|
|
|
foreach (var method in methods)
|
|
|
|
|
{
|
|
|
|
|
if (method.IsPublic)
|
|
|
|
|
{
|
2017-05-10 11:45:23 +00:00
|
|
|
|
table[method.Name] = lua.RegisterFunction("", obj, method);
|
2015-04-10 14:11:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return table;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|