LuaPanda
LuaPanda copied to clipboard
协程coroutine.wrap()创建,断点断不住
看了一下源码,只处理了coroutine.create(),没有处理coroutine.wrap(),这个如何更好的处理?
Debug下钩子需要传thread,coroutine.wrap()方式创建的协程如何去拿thread?
我最近查了一下,这里确实没还有想到好的处理办法,有空的时候我再研究下
遇到了一样的问题,现在有解决方案了吗?
Xlua 的协程就是因为这个问题无法用 luaPanda 断点,试着用 coroutine.resume 替换 coroutine.wrap 解决了 源代码 `local move_end = {}
local generator_mt = {
__index = {
MoveNext = function(self)
self.Current = self.co()
if self.Current == move_end then
self.Current = nil
return false
else
return true
end
end;
Reset = function(self)
self.co = coroutine.wrap(self.w_func)
end
}
}
改成
local generator_mt = {
__index = {
MoveNext = function(self)
return coroutine.resume(self.co)
end;
Reset = function(self)
self.co = coroutine.create(self.w_func)
end
}
}`