mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix: watch hook begin at next call
This commit is contained in:
@@ -114,8 +114,7 @@ function linehook(mode, line)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Lua 5.3 report currentline seems wrong
|
change_prompt(string.format("%s(%d)>",ctx.filename, line))
|
||||||
change_prompt(string.format("%s(%d)>",ctx.filename, line-1))
|
|
||||||
return true -- yield
|
return true -- yield
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -124,14 +123,18 @@ local function add_watch_hook()
|
|||||||
local co = coroutine.running()
|
local co = coroutine.running()
|
||||||
local ctx = {}
|
local ctx = {}
|
||||||
ctx_active[co] = ctx
|
ctx_active[co] = ctx
|
||||||
local level = 3
|
local level = 1
|
||||||
sethook(function()
|
sethook(function(mode)
|
||||||
level = level - 1
|
if mode == "return" then
|
||||||
if level == 0 then
|
level = level - 1
|
||||||
ctx.needupdate = true
|
else
|
||||||
sethook(linehook, "crl")
|
level = level + 1
|
||||||
|
if level == 0 then
|
||||||
|
ctx.needupdate = true
|
||||||
|
sethook(linehook, "crl")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end, "r")
|
end, "cr")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function watch_proto(protoname, cond)
|
local function watch_proto(protoname, cond)
|
||||||
|
|||||||
Reference in New Issue
Block a user