Exemple #1
0
        public (bool WaitForFrame, bool Terminated) ResumeScript(LuaFile lf)
        {
            _currThread = lf.Thread;

            try
            {
                LuaLibraryBase.SetCurrentThread(lf);

                var execResult = _currThread.Resume(0);
                GuiAPI.ThisIsTheLuaAutounlockHack();

                _lua.RunScheduledDisposes();                 // TODO: I don't think this is needed anymore, we run this regularly anyway

                // not sure how this is going to work out, so do this too
                _currThread.RunScheduledDisposes();

                _currThread = null;
                var result = execResult == 0
                                        ? (WaitForFrame : false, Terminated : true)        // terminated
                             : (WaitForFrame : FrameAdvanceRequested, Terminated : false); // yielded

                FrameAdvanceRequested = false;
                return(result);
            }
            catch (Exception)
            {
                GuiAPI.ThisIsTheLuaAutounlockHack();
                throw;
            }
            finally
            {
                LuaLibraryBase.ClearCurrentThread();
            }
        }
Exemple #2
0
        public ResumeResult ResumeScript(Lua script)
        {
            _currThread = script;

            try
            {
                LuaLibraryBase.SetCurrentThread(_currThread);

                var execResult = script.Resume(0);
                script.Resume(1);
                _lua.RunScheduledDisposes();
                //not sure how this is going to work out, so do this too
                script.RunScheduledDisposes();

                _currThread = null;
                var result = new ResumeResult();
                if (execResult == 0)
                {
                    // terminated
                    result.Terminated = true;
                }
                else
                {
                    // yielded
                    result.WaitForFrame = FrameAdvanceRequested;
                }

                FrameAdvanceRequested = false;
                return(result);
            }
            finally
            {
                LuaLibraryBase.ClearCurrentThread();
            }
        }
Exemple #3
0
        public override ResumeResult ResumeScript(LuaFile lf)
        {
            _currThread = lf.Thread;

            try
            {
                LuaLibraryBase.SetCurrentThread(lf);

                var execResult = _currThread.Resume(0);

                _lua.RunScheduledDisposes();                 // TODO: I don't think this is needed anymore, we run this regularly anyway

                // not sure how this is going to work out, so do this too
                _currThread.RunScheduledDisposes();

                _currThread = null;
                var result = new ResumeResult();
                if (execResult == 0)
                {
                    // terminated
                    result.Terminated = true;
                }
                else
                {
                    // yielded
                    result.WaitForFrame = FrameAdvanceRequested;
                }

                FrameAdvanceRequested = false;
                return(result);
            }
            finally
            {
                LuaLibraryBase.ClearCurrentThread();
            }
        }