lua.RegisterFunction(method.Name,null,method);// CLR name
if(string.IsNullOrEmpty(attribute.Name))
lua.RegisterFunction(method.Name,null,method);// CLR name
else
else
lua.RegisterFunction(attribute.Name,null,method);// Custom name
lua.RegisterFunction(attribute.Name,null,method);// Custom name
}
}
}
}
}
}
...
@@ -100,26 +95,25 @@ namespace LuaInterface
...
@@ -100,26 +95,25 @@ namespace LuaInterface
/// <typeparam name="T">The enum type to register</typeparam>
/// <typeparam name="T">The enum type to register</typeparam>
/// <param name="lua">The Lua VM to add the enum to</param>
/// <param name="lua">The Lua VM to add the enum to</param>
[SuppressMessage("Microsoft.Design","CA1004:GenericMethodsShouldProvideTypeParameter",Justification="The type parameter is used to select an enum type")]
[SuppressMessage("Microsoft.Design","CA1004:GenericMethodsShouldProvideTypeParameter",Justification="The type parameter is used to select an enum type")]
publicstaticvoidEnumeration<T>(Lualua)
publicstaticvoidEnumeration<T>(Lualua)
{
{
#regionSanitychecks
#regionSanitychecks
if(lua.IsNull())
if(lua.IsNull())
thrownewArgumentNullException("lua");
thrownewArgumentNullException("lua");
#endregion
#endregion
vartype=typeof(T);
vartype=typeof(T);
if(!type.IsEnum)
if(!type.IsEnum)
thrownewArgumentException("The type must be an enumeration!");
thrownewArgumentException("The type must be an enumeration!");