public string EvaluateLua(string expression)
        {
            bool unfreeze = false;

            if (this.CurrentState == DebugState.Running)
            {
                unfreeze = true;
                if (!GameLoopHook.PauseGame())
                {
                    return("Error: Game is busy!");
                }
            }
            this.DebugEngine.RemoveHook();

            string asStatement = expression;

            expression = "return " + expression;

            string    result = "";
            LuaResult err    = BBLua.luaL_loadbuffer(this.L, expression, expression.Length, "from console");

            if (err == LuaResult.OK)
            {
                int stackTop = BBLua.lua_gettop(this.L);
                err = BBLua.lua_pcall(this.L, 0, -1, 0);
                int nResults = 1 + BBLua.lua_gettop(this.L) - stackTop;

                if (nResults == 1)
                {
                    result = TosToString();
                }
                else if (nResults > 1)
                {
                    string[] results = new string[nResults];
                    do
                    {
                        nResults--;
                        results[nResults] = TosToString(true);
                    } while (nResults != 0);

                    result = "(" + string.Join(", ", results) + ")";
                }
            }
            else
            {
                string parseErrExpr = TosToString();

                err = BBLua.luaL_loadbuffer(this.L, asStatement, asStatement.Length, "from console");
                if (err == LuaResult.OK)
                {
                    err = BBLua.lua_pcall(this.L, 0, 0, 0); //statement -> no return values
                }
                if (err != LuaResult.OK)
                {
                    result = TosToString();
                }
            }

            this.DebugEngine.SetHook();
            if (unfreeze)
            {
                GameLoopHook.ResumeGame();
            }

            return(result);
        }