ILuaMultiValue yield(params ILuaValue[] args)
            {
                ILuaThread thread = E_.Runtime.CurrentThread;

                if (!thread.IsLua)
                {
                    throw new InvalidOperationException("Cannot yield the main thread.");
                }

                return(thread.Yield(E_.Runtime.CreateMultiValue(args)));
            }
 IEnumerable<ILuaValue> resume(ILuaThread thread, params ILuaValue[] args)
 {
     try
     {
         ILuaMultiValue ret = thread.Resume(E_.Runtime.CreateMultiValue(args));
         return new[] { E_.Runtime.CreateValue(true) }.Concat(ret);
     }
     catch (Exception e)
     {
         if (e.Message == "Cannot resume a dead thread.")
             return E_.Runtime.CreateMultiValueFromObj(false, "cannot resume dead coroutine");
         else
             return E_.Runtime.CreateMultiValueFromObj(false, e.Message, e);
     }
 }
예제 #3
0
 IEnumerable <ILuaValue> resume(ILuaThread thread, params ILuaValue[] args)
 {
     try {
         ILuaMultiValue ret = thread.Resume(_env.Runtime.CreateMultiValue(args));
         return(new[] { _env.Runtime.CreateValue(true) }.Concat(ret));
     } catch (Exception e) {
         if (e.Message == "Cannot resume a dead thread.")
         {
             return(_env.Runtime.CreateMultiValueFromObj(false, "cannot resume dead coroutine"));
         }
         else
         {
             return(_env.Runtime.CreateMultiValueFromObj(false, e.Message, e));
         }
     }
 }
 string status(ILuaThread thread)
 {
     return thread.Status.ToString().ToLowerInvariant();
 }
 string status(ILuaThread thread)
 {
     return(thread.Status.ToString().ToLowerInvariant());
 }
            object[] running()
            {
                ILuaThread thread = E_.Runtime.CurrentThread;

                return(new object[] { thread, !thread.IsLua });
            }