public DuktapeThread(DuktapeFunction fn) { var ctx = fn.ctx; var vm = DuktapeVM.GetContext(ctx).vm; var idx = DuktapeDLL.duk_push_thread(ctx); DuktapeDLL.duk_dup(ctx, -1); var ptr = DuktapeDLL.duk_get_heapptr(ctx, -1); _thread = new DuktapeValue(ctx, DuktapeDLL.duk_unity_ref(ctx), ptr); _threadContext = new DuktapeContext(vm, DuktapeDLL.duk_get_context(ctx, idx)); if (fn.Push(_threadContext.rawValue)) { } DuktapeDLL.duk_pop(ctx); }
public DuktapeValue(IntPtr ctx, uint refid, IntPtr heapPtr) { this._context = DuktapeVM.GetContext(ctx); this._refid = refid; this._refPtr = heapPtr; }
public DuktapeValue(IntPtr ctx, uint refid) { this._context = DuktapeVM.GetContext(ctx); this._refid = refid; }
public static DuktapeVM GetVM(IntPtr ctx) { return(DuktapeVM.GetContext(ctx)?._vm); }