public ScriptUserdata CreateUserdata(object obj)
{
Type type = obj as Type;
if (type != null)
{
if (type.GetTypeInfo().IsEnum)
{
return(GetEnum(type));
}
else if (Util.IsDelegateType(type))
{
return(GetDelegate(type));
}
else
{
return(new ScriptUserdataObjectType(this, type, GetScorpioType(type)));
}
}
if (obj is Delegate)
{
return(new ScriptUserdataDelegate(this, (Delegate)obj));
}
else if (obj is BridgeEventInfo)
{
return(new ScriptUserdataEventInfo(this, (BridgeEventInfo)obj));
}
return(new ScriptUserdataObject(this, obj, GetScorpioType(obj.GetType())));
}