Scorpio.Script.CreateUserdata C# (CSharp) Method

CreateUserdata() public method

public CreateUserdata ( object obj ) : ScriptUserdata
obj object
return ScriptUserdata
        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()));
        }
        public void LoadExtension(string type) {

Usage Example

 public void Initialize(Script script, ScriptTable table)
 {
     Table = table;
     table.SetValue("com", script.CreateUserdata(this));
     ScriptArray functions = table.GetValue("registerFunction") as ScriptArray;
     if (functions != null)
     {
         for (int i = 0; i < functions.Count();++i )
         {
             registerFunctions.Add((string)(functions.GetValue(i).ObjectValue));
         }
     }
     OnStart();
 }