示例#1
0
        protected void GetVarAndCleanG(string varName)
        {
            BBLua.lua_getglobal(ls.L, varName); //fetch value

            BBLua.lua_pushnil(ls.L);
            BBLua.lua_setglobal(ls.L, varName); //remove from _G
        }
        //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);
        }
示例#3
0
        protected void TryFakeVar(string varName, int n, List <FakeVar> memory)
        {
            BBLua.lua_getglobal(ls.L, varName);
            bool fakePossible = BBLua.lua_type(ls.L, -1) == LuaType.Nil;

            BBLua.lua_settop(ls.L, -2); //remove nil
            if (fakePossible)
            {
                memory.Add(new FakeVar(n, varName));
                BBLua.lua_setglobal(ls.L, varName);
            }
            else
            {
                BBLua.lua_settop(ls.L, -2); //remove value
            }
        }