vscode中使用luaide-lite插件断点调试cocos2dx-lua

使用quick-cocos2dx-lua,用了众多插件,包括免费的BabeLua,VS调试太慢,vscode上的免费的EmmyLua, 还有收费的luaide,都没搞出来,唯独这个免费luaide-lite用成功了,步骤也简单,可以断点调试,查看变量数值,非常实用,简单记录下

  1. 在vscode插件里下载luaide-ide,如下图:
  1. 配置launch.json
cpp 复制代码
{
            "name": "COCOS(remote debugging)",
            "type": "lua",
            "request": "launch",
            "runtimeType": "Cocos3",
            "localRoot": "${workspaceRoot}",
            "commandLine": ["-workdir ${workspaceRoot}/../ -file src/main.lua"],
            "port": 7003,
            "mainFile": "src/main.lua",
            "exePath": "D:/malai_pub/hall/runtime/win32/hall.exe",
            "printType": 1
        },

这里commandLine,和mainFile,exePath可以根据自己的代码的情况自己配,我的是先装了luaIde让它自己配置了看它的示例写的

3 . 下载luaide-lite的配置文件,丢到自己lua工程代码根目录下,其中一个是LuaDebug.lua,一个是luaide文件夹,配置文件 luaide-lite配置文件 ,您也可以自己到官方github下:GitHub - wellshsu/luaide-lite: Lua developement and debug tools.

  1. 将以下标注代码添加在main.lua处

代码:require("LuaDebug")("localhost", 7003)

其实只需要那句require("LuaDebug")("localhost", 7003)就行了,其他什么bRemoteDebug啊都是无效代码

OK,现在就已经完事了,在vscode里下断点,然后选中你刚才的debug配置,开始按F5调试吧

相关推荐
huoyueyi8 小时前
《融天AI-APP从0到1开发实录》
开发语言·lua
MicrosoftReactor14 小时前
技术速递|超越一刀切:为 GitHub Copilot CLI 和 VS Code 实现决策路由
vscode·ai·github·copilot·决策路由
努力努力再努力wz1 天前
【Lua入门系列】从动态类型到变量作用域:彻底理解 local、全局变量与跨文件访问
开发语言·junit·lua
2501_915918411 天前
Windows 上开发 React Native iOS,真机调试、Fast Refresh 与打包 ipa
windows·vscode·react native·ios·个人开发·swift·敏捷流程
golang学习记2 天前
Zed Git重大更新:目录级对比支持分栏Diff
git·vscode·zed
买房动力十足2 天前
秒杀商城 + AI 运营:Lua 防超卖、MQ 削峰,AI 负责选品和策划
开发语言·人工智能·lua
2501_915106322 天前
iOS 单元测试怎么跑?用 KXApp 在 VS Code 里跑 XCTest 和 Swift Testing
ide·vscode·ios·单元测试·个人开发·swift·敏捷流程
golang学习记3 天前
VS Code Agents新特性:标签页式工作区选择器
vscode
golang学习记4 天前
VS Code Agents 新快捷键:一键穿梭主编辑器与Agent窗口
vscode·编辑器