BizHawk/BizHawk.Client.Common/lua/LuaHelper.cs

26 lines
450 B
C#
Raw Normal View History

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;
}
}
}