[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua version census - the results!
- From: Paul K <paul@...>
- Date: Thu, 6 Feb 2020 07:53:43 -0800
>> And it also won't work if you want to use debug hooks on a separate
>> coroutine (e.g. abort after N instructions or on any attempted
>> call, for safely un-dumping some values).
> I can't reproduce your problem.
> The following code works fine for me.
> Tested on both vanilla Lua and LuaJIT 2.1
Maybe it was meant to emphasize that LuaJIT debug hooks are global
(whereas Lua hooks are per coroutine):
LuaJIT will accept co as the parameter, but ignores it as far as I can
tell. If you slightly tweak your example, you can see that the hook is
called during the standalone FuncMore() call in LuaJIT, but not in
-- create a separate coroutine
local function FuncMore()
local function Func() end
local co = coroutine.create(FuncMore)
-- set hook on the separate coroutine
local info = debug.getinfo(co, 2, "n")
local func_name = info and info.name or "?"
'cr' -- on function call and return
-- run the separate coroutine