예제 #1
0
        //returns false if game was busy
        public bool SaveLoadedFiles()
        {
            bool wasRunning = this.DebugEngine.CurrentState == DebugState.Running;

            if (wasRunning)
            {
                if (!GameLoopHook.PauseGame())
                {
                    return(false);
                }
            }

            string data = CreateFileString();

            BBLua.lua_newtable(this.L);
            int i = 1;

            foreach (string substr in data.SplitBy(15000)) //the limit in shok seems to be at ~ 2^14, otherwise crashes savegame loading
            {
                BBLua.lua_pushstring(this.L, substr);
                BBLua.lua_rawseti(this.L, -2, i);
                i++;
            }
            BBLua.lua_setglobal(this.L, "_LuaDebugger_FileData");

            if (wasRunning)
            {
                GameLoopHook.ResumeGame();
            }

            return(true);
        }