Ejemplo n.º 1
0
    static void CopyLuaBytesFiles(string sourceDir, string destDir, bool appendext = true, string searchPattern = "*.lua", SearchOption option = SearchOption.AllDirectories)
    {
        if (!Directory.Exists(sourceDir))
        {
            return;
        }

        string[] files = Directory.GetFiles(sourceDir, searchPattern, option);
        int      len   = sourceDir.Length;

        if (sourceDir[len - 1] == '/' || sourceDir[len - 1] == '\\')
        {
            --len;
        }
        XLua.LuaEnv L = new XLua.LuaEnv();
        for (int i = 0; i < files.Length; i++)
        {
            string str  = files[i].Remove(0, len);
            string dest = destDir + "/" + str;
            if (appendext && !dest.EndsWith(".bytes"))
            {
                dest += ".bytes";
            }
            string dir = Path.GetDirectoryName(dest);
            Directory.CreateDirectory(dir);
            CompileLuaFile(L, files[i], dest);
            //File.Copy(files[i], dest, true);
        }

        L.LuacClear();
        L.GC();
        L.Dispose();
    }
Ejemplo n.º 2
0
 public void test()
 {
     Manager.Instance.RemoveAllDaemon();
     ClearCommand();
     ClearText();
     L.GC();
     L.Dispose();
     L = new XLua.LuaEnv();
     L.DoString("require ('Main')");
     L.DoString("OnStart()");
 }
Ejemplo n.º 3
0
        internal const float GCInterval  = 1;//1 second

        private void Update()
        {
            if (LuaEnv != null)
            {
                LuaEnv.Tick();
                if (Time.time - LuaController.lastGCTime > GCInterval)
                {
                    if (LuaEnv.Memroy > 50)
                    {
                        LuaEnv.GC();
                    }

                    LuaController.lastGCTime = Time.time;
                }
            }
        }
Ejemplo n.º 4
0
        static int _m_GC(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLua.LuaEnv gen_to_be_invoked = (XLua.LuaEnv)translator.FastGetCSObj(L, 1);



                {
                    gen_to_be_invoked.GC(  );



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }