static internal int checkDelegate(IntPtr l, int p, out UnityEngine.WSA.AppCallbackItem ua)
        {
            int op = extractFunction(l, p);

            if (LuaDLL.lua_isnil(l, p))
            {
                ua = null;
                return(op);
            }
            else if (LuaDLL.lua_isuserdata(l, p) == 1)
            {
                ua = (UnityEngine.WSA.AppCallbackItem)checkObj(l, p);
                return(op);
            }
            LuaDelegate ld;

            checkType(l, -1, out ld);
            if (ld.d != null)
            {
                ua = (UnityEngine.WSA.AppCallbackItem)ld.d;
                return(op);
            }
            LuaDLL.lua_pop(l, 1);

            l  = LuaState.get(l).L;
            ua = () =>
            {
                int error = pushTry(l);

                ld.pcall(0, error);
                LuaDLL.lua_settop(l, error - 1);
            };
            ld.d = ua;
            return(op);
        }
Example #2
0
 /// <summary>
 /// Invoke a task in main thread, used when setting properties of gameobjects
 /// </summary>
 public static void InvokeMain(UnityEngine.WSA.AppCallbackItem item, bool waitUntilDone)
 {
     if (UnityEngine.WSA.Application.RunningOnAppThread())
     {
         item.Invoke();
     }
     else
     {
         UnityEngine.WSA.Application.InvokeOnAppThread(item, waitUntilDone);
     }
 }
 private static void RunInUWPUIThread(UnityEngine.WSA.AppCallbackItem handler)
 {
     UnityEngine.WSA.Application.InvokeOnUIThread(handler, false);
 }