lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Mar 2, 2021 at 1:16 PM bel <bel2125@gmail.com> wrote:

> I never used the word "bug" [...] and that was meant completely neutral ... could have been that I interpret that paragraph in the manual in a different way than it was meant to be, and that's why I post some code.

If you think the word 'bug' is somehow bad, fine, don't use it. It
does not matter. When you think there is a discrepancy between
documentation and observed behavior, you should report minimal repro
steps toward that discrepancy. You actually tried in your first
attempt, and it correctly demonstrated no discrepancy.

Posting your whole research project was unnecessary at that point.

> Wouldn't this have the side effect that the Lua code can no longer use other coroutines?

Possibly, but, as I said, either you do what you want by breaking
Lua's official rules, or you would have to live with some
restrictions.

This entire topic is not new. Some applications embedding Lua also
have a need to terminate a running Lua state, without bringing the
host down. This is not easy and I am not aware of a really good
solution to this. I actually think we should have support for this
built into Lua, but this won't help any current or past versions.

> There is an arbitrarily structured Lua code that may contain other coroutines as well, and at some point this code decides it found what it was looking for, or there is an unrecoverable problem.

Coroutines are not a (major) problem here. Your problem is
lua_pcall(), and we are talking about coroutines because of your
mistaken assumption that coroutines could somehow jump over
lua_pcall() boundaries.

Cheers,
V.