Example #1
0
        public void RegisterLuaClassType(Type klass, Type luaClass)
        {
            LuaClassType luaClassType = new LuaClassType();

            luaClassType.klass = luaClass;
            GetReturnTypesFromClass(klass, out luaClassType.returnTypes);
            classCollection [klass] = luaClassType;
        }
Example #2
0
        /*
         * Gets an instance of an implementation of the klass interface or
         * subclass of klass that delegates public virtual methods to the
         * luaTable table.
         * Caches the generated type.
         */
        public object GetClassInstance(Type klass, LuaTable luaTable)
        {
            LuaClassType luaClassType;

            if (classCollection.ContainsKey(klass))
            {
                luaClassType = classCollection[klass];
            }
            else
            {
                luaClassType = new LuaClassType();
                GenerateClass(klass, out luaClassType.klass, out luaClassType.returnTypes);
                classCollection[klass] = luaClassType;
            }
            return(Activator.CreateInstance(luaClassType.klass, new object[] { luaTable, luaClassType.returnTypes }));
        }
Example #3
0
 public void RegisterLuaClassType(Type klass, Type luaClass)
 {
     LuaClassType luaClassType = new LuaClassType ();
     luaClassType.klass = luaClass;
     GetReturnTypesFromClass (klass, out luaClassType.returnTypes);
     classCollection [klass] = luaClassType;
 }
Example #4
0
        /*
         * Gets an instance of an implementation of the klass interface or
         * subclass of klass that delegates public virtual methods to the
         * luaTable table.
         * Caches the generated type.
         */
        public object GetClassInstance(Type klass, LuaTable luaTable)
        {
            LuaClassType luaClassType;

            if (classCollection.ContainsKey (klass))
                luaClassType = classCollection [klass];
            else {
                luaClassType = new LuaClassType ();
                GenerateClass (klass, out luaClassType.klass, out luaClassType.returnTypes);
                classCollection [klass] = luaClassType;
            }

            return Activator.CreateInstance (luaClassType.klass, new object[] {
                luaTable,
                luaClassType.returnTypes
            });
        }