Ejemplo n.º 1
0
        public bool Resume(out object value)
        {
            var ctx = _thread.ctx;

            DuktapeDLL.duk_push_c_function(ctx, DuktapeDLL.duk_unity_thread_resume, DuktapeDLL.DUK_VARARGS);
            if (_thread.Push(ctx))
            {
                DuktapeDLL.duk_push_null(ctx); // 预留
                DuktapeDLL.duk_call(ctx, 2);
                DuktapeBinding.duk_get_var(ctx, -1, out value);
                DuktapeDLL.duk_pop(ctx);
                if (_thread.Push(ctx))
                {
                    var state = DuktapeDLL.duk_unity_thread_state(ctx);
                    DuktapeDLL.duk_pop(ctx);
                    return(state != 5);
                }
            }
            else
            {
                DuktapeDLL.duk_pop(ctx);
            }

            value = null;
            return(false);
        }
Ejemplo n.º 2
0
        private static bool Equals(DuktapeValue x, DuktapeValue y)
        {
            var ctx = x._context.rawValue;

            x.Push(ctx);
            y.Push(ctx);
            var eq = DuktapeDLL.duk_equals(ctx, -1, -2);

            DuktapeDLL.duk_pop_2(ctx);
            return(eq);
        }