lua-users home
lua-l archive

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

On Sun, Aug 23, 2020 at 8:45 PM Viacheslav Usov wrote:
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..."

The hook does not successfully yield in this example.
"coroutine.yield()" raises an exception "attempt to yield across a C-call boundary".
The coroutine dies, and the main thread resumes execution.

So either the documentation or the behavior is wrong.

Both are correct: the call hook can not yield.