int jass_call_closure(lua_State* L) { if (!is_gaming()) { lua_pushnil(L); return 1; } int result = jass_call_native_function(L, (const jass::func_value*)lua_tointeger(L, lua_upvalueindex(1))); if (lua_isyieldable(L)) { jass_vm_t* thread = get_jass_thread(); if (thread && thread->has_sleep) { thread->opcode -= jass::trampoline_size() / sizeof(jass::opcode); return lua_yield(L, 0); } } return result; }
uintptr_t get_current_jass_pos() { uintptr_t thread = get_jass_thread(); return (uintptr_t)(*(jass::opcode**)(thread + 0x20) - 1); }