lua-users home
lua-l archive

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


On Sun, Aug 23, 2020 at 5:26 PM Viacheslav Usov <via.usov@gmail.com> 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.

Cheers,
V.