[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: documentation (?) bug: call hook yields [WAS: Re: Strange way to determine whether it is Lua or C function]
- From: Viacheslav Usov <via.usov@...>
- Date: Sun, 23 Aug 2020 19:44:49 +0200
On Sun, Aug 23, 2020 at 5:26 PM Viacheslav Usov <firstname.lastname@example.org> wrote:
> The coroutine business ensures that the test subjects never actually run.
... while according to the documentation, it should not. Here is the
relevant line of code:
debug.sethook(x, function() x=debug.getlocal(2,2) coroutine.yield() end, "c")
This sets a call hook, which yields. Relevant documentation: "Hook
functions can yield under the following conditions: Only count and
line events can yield..." It is not stated what should happen if the
condition is not met, but in my tests (Lua 5.3) it seems most
certainly that the main thread resumes execution, while the hooked
function, either C or Lua, does not execute any longer.
So either the documentation or the behavior is wrong.