示例#1
0
        private ThreadStatus D_RawRunProtected <T>(PFuncDelegate <T> func, ref T ud)
        {
            int          oldNumCSharpCalls = NumCSharpCalls;
            ThreadStatus res = ThreadStatus.LUA_OK;

            try {
                func(ref ud);
            }
            catch (LuaRuntimeException e) {
                NumCSharpCalls = oldNumCSharpCalls;
                res            = e.ErrCode;
            }

            NumCSharpCalls = oldNumCSharpCalls;
            return(res);
        }
示例#2
0
文件: Do.cs 项目: matthewyang/UniLua
        private ThreadStatus D_PCall( PFuncDelegate func, object ud,
			StkId oldTop, int errFunc )
        {
            CallInfo oldCI 			= CI;
            bool oldAllowHook 		= AllowHook;
            int oldNumNonYieldable	= NumNonYieldable;
            int oldErrFunc			= ErrFunc;

            ErrFunc = errFunc;
            ThreadStatus status = D_RawRunProtected( func, ud );
            if( status != ThreadStatus.LUA_OK ) // an error occurred?
            {
                F_Close( oldTop );
                SetErrorObj( status, oldTop );
                CI = oldCI;
                AllowHook = oldAllowHook;
                NumNonYieldable = oldNumNonYieldable;
            }
            ErrFunc = oldErrFunc;
            return status;
        }
示例#3
0
        private ThreadStatus D_PCall <T>(PFuncDelegate <T> func, ref T ud,
                                         int oldTopIndex, int errFunc)
        {
            int  oldCIIndex         = CI.Index;
            bool oldAllowHook       = AllowHook;
            int  oldNumNonYieldable = NumNonYieldable;
            int  oldErrFunc         = ErrFunc;

            ErrFunc = errFunc;
            ThreadStatus status = D_RawRunProtected <T>(func, ref ud);

            if (status != ThreadStatus.LUA_OK)              // an error occurred?
            {
                F_Close(Stack[oldTopIndex]);
                SetErrorObj(status, Stack[oldTopIndex]);
                CI              = BaseCI[oldCIIndex];
                AllowHook       = oldAllowHook;
                NumNonYieldable = oldNumNonYieldable;
            }
            ErrFunc = oldErrFunc;
            return(status);
        }
示例#4
0
文件: Do.cs 项目: matthewyang/UniLua
 private ThreadStatus D_RawRunProtected( PFuncDelegate func, object ud )
 {
     int oldNumCSharpCalls = NumCSharpCalls;
     ThreadStatus res = ThreadStatus.LUA_OK;
     try
     {
         func( ud );
     }
     catch( LuaRuntimeException e )
     {
         NumCSharpCalls = oldNumCSharpCalls;
         res = e.ErrCode;
     }
     NumCSharpCalls = oldNumCSharpCalls;
     return res;
 }