fix Dictionary export
filter function in unity3d editor lib but not in runtime lib which cause compile er
@@ -1934,6 +1934,30 @@ namespace SLua
}
}
+ if (mi.DeclaringType.IsGenericType && mi.DeclaringType.GetGenericTypeDefinition() == typeof(Dictionary<,>))
+ {
+ if (mi.MemberType == MemberTypes.Constructor)
+ {
+ ConstructorInfo constructorInfo = mi as ConstructorInfo;
+ var parameterInfos = constructorInfo.GetParameters();
+ if (parameterInfos.Length > 0)
+ {
+ if (typeof(System.Collections.IEnumerable).IsAssignableFrom(parameterInfos[0].ParameterType))
+ {
+ return true;
+ }
+ }
+ }
+ else if (mi.MemberType == MemberTypes.Method)
+ {
+ var methodInfo = mi as MethodInfo;
+ if (methodInfo.Name == "TryAdd" || methodInfo.Name == "Remove" && methodInfo.GetParameters().Length == 2)
+ {
+ return true;
+ }
+ }
+ }
+
return mi.IsDefined(typeof(DoNotToLuaAttribute), false);
}
