пт, 5 дек. 2025 г. в 15:58, Xmilia Hermit <
xmilia...@gmail.com>:
>
>
> > Lua code, specifically lua/lstate.h, hints that resuming __close should
> > be possible if it's invoked because of an error:
>
> You are calling the __close method through coroutine.close and not due
> to the error. The error is never catched and so the __close methods
> never called during the coroutine.resume call. Try running your
> coroutine function through a pcall and it will work.
Thanks a lot, that worked! Is that completely impossible to yield in
__close, if it's a result of coroutine.close? I'm trying to implement
a try/finally mechanism providing a cleanup function for coroutines
that raised an error, but it would be great to get it to work for
manually cancelled coroutines too.
Cheers,
Artem