public ObjectTranslator(Lua interpreter,IntPtr luaState)
        {
            this.interpreter=interpreter;
            typeChecker=new CheckType(this);
            metaFunctions=new MetaFunctions(this);
            objects=new ArrayList();
            assemblies=new ArrayList();

            importTypeFunction=new LuaCSFunction(this.importType);
            importType__indexFunction=new LuaCSFunction(this.importType__index);
            loadAssemblyFunction=new LuaCSFunction(this.loadAssembly);
            loadAssemblyFromFunction=new LuaCSFunction(this.loadAssemblyFrom);
            registerTableFunction=new LuaCSFunction(this.registerTable);
            unregisterTableFunction=new LuaCSFunction(this.unregisterTable);
            getMethodSigFunction=new LuaCSFunction(this.getMethodSignature);
            getConstructorSigFunction=new LuaCSFunction(this.getConstructorSignature);

            createLuaObjectList(luaState);
            createIndexingMetaFunction(luaState);
            createBaseClassMetatable(luaState);
            createClassMetatable(luaState);
            createFunctionMetatable(luaState);
            setGlobalFunctions(luaState);

            LuaDLL.lua_dostring(luaState, "load_assembly('mscorlib')");
        }
Esempio n. 2
0
        public ObjectTranslator(LuaState interpreter,IntPtr luaState)
        {
            this.interpreter=interpreter;
            typeChecker=new CheckType(this);
            metaFunctions=new MetaFunctions(this);
            assemblies=new List<Assembly>();
            assemblies.Add(Assembly.GetExecutingAssembly());

            importTypeFunction = new LuaCSFunction(ObjectTranslator.importType);
            loadAssemblyFunction = new LuaCSFunction(ObjectTranslator.loadAssembly);
            registerTableFunction = new LuaCSFunction(ObjectTranslator.registerTable);
            unregisterTableFunction = new LuaCSFunction(ObjectTranslator.unregisterTable);
            getMethodSigFunction = new LuaCSFunction(ObjectTranslator.getMethodSignature);
            getConstructorSigFunction = new LuaCSFunction(ObjectTranslator.getConstructorSignature);

            ctypeFunction = new LuaCSFunction(ObjectTranslator.ctype);
            enumFromIntFunction = new LuaCSFunction(ObjectTranslator.enumFromInt);

            createLuaObjectList(luaState);
            createIndexingMetaFunction(luaState);
            createBaseClassMetatable(luaState);
            createClassMetatable(luaState);
            createFunctionMetatable(luaState);
            setGlobalFunctions(luaState);
        }
 public ObjectTranslator(Lua interpreter, IntPtr luaState)
 {
     this.interpreter = interpreter;
     this.typeChecker = new CheckType(this);
     this.metaFunctions = new MetaFunctions(this);
     this.assemblies = new List<Assembly>();
     this.importTypeFunction = new LuaCSFunction(this.importType);
     this.loadAssemblyFunction = new LuaCSFunction(this.loadAssembly);
     this.registerTableFunction = new LuaCSFunction(this.registerTable);
     this.unregisterTableFunction = new LuaCSFunction(this.unregisterTable);
     this.getMethodSigFunction = new LuaCSFunction(this.getMethodSignature);
     this.getConstructorSigFunction = new LuaCSFunction(this.getConstructorSignature);
     this.createLuaObjectList(luaState);
     this.createIndexingMetaFunction(luaState);
     this.createBaseClassMetatable(luaState);
     this.createClassMetatable(luaState);
     this.createFunctionMetatable(luaState);
     this.setGlobalFunctions(luaState);
 }
        public ObjectTranslator(lua.State L, Lua interpreter)
        {
            Debug.Assert(interpreter.IsSameLua(L));
            luaclr.checkstack(L, 1, "new ObjectTranslator");
            this.interpreter = interpreter;
            typeChecker      = new CheckType(interpreter);
            metaFunctions    = new MetaFunctions(L, this);

            StackAssert.Start(L);
            lua.pushcfunction(L, _loadAssembly        = this.loadAssembly); lua.setglobal(L, "load_assembly");
            lua.pushcfunction(L, _importType          = this.importType); lua.setglobal(L, "import_type");
            lua.pushcfunction(L, _makeObject          = this.makeObject); lua.setglobal(L, "make_object");
            lua.pushcfunction(L, _freeObject          = this.freeObject); lua.setglobal(L, "free_object");
            lua.pushcfunction(L, _getMethodBysig      = this.getMethodBysig); lua.setglobal(L, "get_method_bysig");
            lua.pushcfunction(L, _getConstructorBysig = this.getConstructorBysig); lua.setglobal(L, "get_constructor_bysig");
            lua.pushcfunction(L, _ctype = this.ctype); lua.setglobal(L, "ctype");
            lua.pushcfunction(L, _enum  = this.@enum); lua.setglobal(L, "enum");
            StackAssert.End();
        }
Esempio n. 5
0
        public ObjectTranslator(Lua interpreter, KopiLua.LuaState luaState)
        {
            this.interpreter = interpreter;
            typeChecker      = new CheckType(this);
            metaFunctions    = new MetaFunctions(this);
            assemblies       = new List <Assembly>();

            importTypeFunction        = new KopiLua.LuaNativeFunction(this.importType);
            loadAssemblyFunction      = new KopiLua.LuaNativeFunction(this.loadAssembly);
            registerTableFunction     = new KopiLua.LuaNativeFunction(this.registerTable);
            unregisterTableFunction   = new KopiLua.LuaNativeFunction(this.unregisterTable);
            getMethodSigFunction      = new KopiLua.LuaNativeFunction(this.getMethodSignature);
            getConstructorSigFunction = new KopiLua.LuaNativeFunction(this.getConstructorSignature);

            createLuaObjectList(luaState);
            createIndexingMetaFunction(luaState);
            createBaseClassMetatable(luaState);
            createClassMetatable(luaState);
            createFunctionMetatable(luaState);
            setGlobalFunctions(luaState);
        }
        public ObjectTranslator(Lua interpreter,KopiLua.Lua.lua_State luaState)
        {
            this.interpreter=interpreter;
            typeChecker=new CheckType(this);
            metaFunctions=new MetaFunctions(this);
            assemblies=new List<Assembly>();

            importTypeFunction=new KopiLua.Lua.lua_CFunction(this.importType);
            loadAssemblyFunction=new KopiLua.Lua.lua_CFunction(this.loadAssembly);
            registerTableFunction=new KopiLua.Lua.lua_CFunction(this.registerTable);
            unregisterTableFunction=new KopiLua.Lua.lua_CFunction(this.unregisterTable);
            getMethodSigFunction=new KopiLua.Lua.lua_CFunction(this.getMethodSignature);
            getConstructorSigFunction=new KopiLua.Lua.lua_CFunction(this.getConstructorSignature);

            createLuaObjectList(luaState);
            createIndexingMetaFunction(luaState);
            createBaseClassMetatable(luaState);
            createClassMetatable(luaState);
            createFunctionMetatable(luaState);
            setGlobalFunctions(luaState);
        }
Esempio n. 7
0
        public ObjectTranslator(LuaState interpreter, IntPtr luaState)
        {
            this.interpreter = interpreter;
            weakTableRef     = -1;
            typeChecker      = new CheckType(this);
            metaFunctions    = new MetaFunctions(this);
            assemblies       = new List <Assembly>();
            assemblies.Add(Assembly.GetExecutingAssembly());

            importTypeFunction      = new LuaCSFunction(importType);
            loadAssemblyFunction    = new LuaCSFunction(loadAssembly);
            unregisterTableFunction = new LuaCSFunction(unregisterTable);
            ctypeFunction           = new LuaCSFunction(ctype);
            enumFromIntFunction     = new LuaCSFunction(enumFromInt);

            createLuaObjectList(luaState);
            createIndexingMetaFunction(luaState);
            createBaseClassMetatable(luaState);
            createClassMetatable(luaState);
            createFunctionMetatable(luaState);
            setGlobalFunctions(luaState);
        }
 public ObjectTranslator(LuaState interpreter, IntPtr luaState)
 {
     this.interpreter   = interpreter;
     this.weakTableRef  = -1;
     this.typeChecker   = new CheckType(this);
     this.metaFunctions = new MetaFunctions(this);
     this.assemblies    = new List <Assembly>();
     this.assemblies.Add(Assembly.GetExecutingAssembly());
     this.importTypeFunction        = new LuaCSFunction(ObjectTranslator.importType);
     this.loadAssemblyFunction      = new LuaCSFunction(ObjectTranslator.loadAssembly);
     this.registerTableFunction     = new LuaCSFunction(ObjectTranslator.registerTable);
     this.unregisterTableFunction   = new LuaCSFunction(ObjectTranslator.unregisterTable);
     this.getMethodSigFunction      = new LuaCSFunction(ObjectTranslator.getMethodSignature);
     this.getConstructorSigFunction = new LuaCSFunction(ObjectTranslator.getConstructorSignature);
     this.ctypeFunction             = new LuaCSFunction(ObjectTranslator.ctype);
     this.enumFromIntFunction       = new LuaCSFunction(ObjectTranslator.enumFromInt);
     this.createLuaObjectList(luaState);
     this.createIndexingMetaFunction(luaState);
     this.createBaseClassMetatable(luaState);
     this.createClassMetatable(luaState);
     this.createFunctionMetatable(luaState);
     this.setGlobalFunctions(luaState);
 }
Esempio n. 9
0
        internal Array TableToArray(object luaParamValue, Type paramArrayType)
        {
            Array array;

            if (luaParamValue is LuaTable)
            {
                LuaTable luaTable = (LuaTable)luaParamValue;
                IDictionaryEnumerator enumerator = luaTable.GetEnumerator();
                enumerator.Reset();
                array = Array.CreateInstance(paramArrayType, luaTable.Values.Count);
                int num = 0;
                while (enumerator.MoveNext())
                {
                    object obj = enumerator.Value;
                    if (paramArrayType == typeof(object) && obj != null && obj.GetType() == typeof(double) && MetaFunctions.IsInteger((double)obj))
                    {
                        obj = Convert.ToInt32((double)obj);
                    }
                    array.SetValue(Convert.ChangeType(obj, paramArrayType), num);
                    num++;
                }
            }
            else
            {
                array = Array.CreateInstance(paramArrayType, 1);
                array.SetValue(luaParamValue, 0);
            }
            return(array);
        }