-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
无法调试lua #198
Comments
要更新调试器。vscode 的那个更新了没? @actboy168 |
@constly 我测试是没问题的,你是不是没更新调试器。 |
昨天晚上卸载重装了Lua Debug插件,不得行,不过今天早上来引擎的demo项目可以调试了(可能是重启了电脑)。 现在我这里自己的项目以及vaststars依然不能调试,
vaststars的launch.json为:
|
PS G:\ant\github\vaststars> & 'G:/ant/github/vaststars/bin/msvc/debug/ant.exe' '-e' 'dofile[[c:/Users/username/.vscode/extensions/actboy168.lua-debug-2.0.10-win32-x64/script/launch.lua]];DBG[[38296/lua-latest]]' 'startup/main.lua'
Service 1 error: /engine/firmware/ltask_service.lua:1: attempt to index a nil value
stack traceback:
/engine/firmware/ltask_service.lua:1: in main chunk
PS G:\ant\github\vaststars> 深感认同,这个报错我调试时也一直出现。即使用最新的Lua Debug也不行 跟踪了一下发现 local function dofile(filename)
local f = assert(io.open(filename))
local str = f:read "a"
f:close()
return assert(load(str, "=(debugger.lua)"))(filename)
end
local path = os.getenv "LUA_DEBUG_PATH"
if path then --此处path为nil,获取不到环境变量值。
return dofile(path)
: attach {}
end |
继续跟踪到 local isWindows = package.config:sub(1, 1) == "\\"
if isWindows then
assert(package.loadlib(luadebug, 'init'))(cfg.luaapi)
end
---@type LuaDebug
dbg.rdebug = assert(package.loadlib(luadebug, 'luaopen_luadebug'))()
if not os.getenv "LUA_DEBUG_PATH" then
print("set path:", selfsource) --添加打印
dbg.rdebug.setenv("LUA_DEBUG_PATH", selfsource)
print("get path:", os.getenv("LUA_DEBUG_PATH")) --添加打印
print("java home path:", os.getenv("JAVA_HOME")) --添加打印
else
print("pre set:", os.getenv("LUA_DEBUG_PATH"))
end 打印结果是: set path: c:/Users/abc/.vscode/extensions/actboy168.lua-debug-2.0.10-win32-x64/script/debugger.lua
get path: nil
java home path: D:\Program Files\Java\jdk-19 |
我按readme中的说明,把launch.json中的配置为:
在vscode中以调试方式启动时没反应,输出为:
看起来没启动成功,程序直接退出了。我打开任务管理器,可以看到有lua-debug.exe。
之前是可以调试的,不知道那次更新后就不行了。
The text was updated successfully, but these errors were encountered: