返回

您好,大神。

在lua 5.1中,想要在协程中追踪错误信息。
我尝试了下面的代码

local coroutine_create = coroutine.create
function coroutine.create(func)
    return coroutine_create(function() xpcall(func) end)
end

但是发现,xpcall 就是一个C Func, 在执行 coroutine.yield的时候,会出现错误
attempt to yield across metamethod/C-call boundary

请问,我能有什么方法来实现目的(在协程中追踪错误信息)呢?

名字: 自动排版 密码:

回复 | (2804) | 凌风 | 2014-11-14 02:30:20