问题描述
如何调试嵌入在c ++应用程序中的lua代码?
How do you debug lua code embedded in a c++ application?
从我收集的内容中,我需要购买一个特殊的IDE,并在他们的特殊lua运行时链接(啊)。或者,我需要使用调用。
From what I gather, either I need to buy a special IDE and link in their special lua runtime (ugh). Or I need to build a debug console in to the game engine, using the lua debug API calls.
我倾向于编写自己的调试控制台,但这似乎是很多工作。时间,我可以更好地抛光游戏的其他部分。
I am leaning toward writing my own debug console, but it seems like a lot of work. Time that I could better spend polishing the other portions of the game.
推荐答案
有几个工具浮动可以做至少你想要的部分我已经看到对VS插件的引用,在Lua for Windows中有一个SciTE调试器扩展,并且有开普勒项目的,以及他们的。
There are several tools floating around that can do at least parts of what you want. I have seen references to a VS plugin, there is a SciTE debugger extension in Lua for Windows, and there is the Kepler project's RemDebug, as well as their LuaEclipse.
RemDebug可能在您需要的轨道上,因为它被构建为允许调试在Lua中编写的CGI脚本。它需要访问LuaSocket模块,以在目标脚本和控制器之间提供通信通道,以及一些其他模块。
RemDebug may be on the track of what you need, as it was built to allow for debugging CGI scripts written in Lua. It does require access to the LuaSocket module to provide a communications channel between the target script and a controller as well as a couple of other modules.
更大的问题可能是能够从游戏引擎放在你的脚本中的任何一个沙盒中加载任意模块。如果您对引擎有一定的控制权,那么这不是一个大问题。
A bigger issue might be the ability to load arbitrary modules from within whatever sandbox the game engine has put around your scripts. If you have some control over the engine, then that won't be as big an issue.
例如,由于Lightroom不会公开 require
,Adobe Lightroom插件的开发人员目前无法使用此功能。在插件的沙箱里面。
This isn't currently possible for developers of Adobe Lightroom plugins, for example, because Lightroom does not expose require
inside the plugin's sandbox.
对于我来说,一个惊喜是在Lua工作时,很少有人觉得需要一个调试器。我已经为各种项目构建了几个小应用程序,并且惊讶于完整的堆栈后跟和偶尔的 print
调用的组合有助于找到错误, code> requirestrict首先没有阻止。
A surprise to me has been how rarely I have felt a need for a debugger when working with Lua. I've built several small applications in it for various projects and have been surprised at how well a combination of complete stack backtraces and the occasional print
call works to locate the bugs that require "strict"
didn't prevent in the first place.
这篇关于调试嵌入Lua的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!