lua-users home
lua-l archive

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


I am aware of the limitation of yielding across C-call boundaries, and have checked out related discussions in the archives -- however I'd like to better understand this case:

local function hook(event, line)
 print(debug.traceback())
 coroutine.yield()
end

local pr = assert(loadfile("test.lua"))
local cr = coroutine.create(pr)
debug.sethook(cr, hook, "clr")

print(coroutine.resume(cr))

which produces:

stack traceback:
        run.lua:7: in function <run.lua:6>
        test.lua:5: in main chunk
false   attempt to yield across metamethod/C-call boundary

"run.lua" is the name of the file with the above code, "test.lua" just contains some dummy code, function "<run.lua:6>" refers to function "hook" above.

Shouldn't I see the "C-call boundary" in the stack trace? What do I miss?

Thanks and regards
- Stefan