去虫"attemp to index nil value"

Debbuging "attemp to index nil value"

本文关键字:nil value index to attemp 去虫      更新时间:2023-10-16

我有一个巨大的代码,涉及到c++, Lua和两者之间的集成。

我调用一个与lua_State*一起工作的C函数,并且在其中的某个地方我得到一个"尝试索引nil值"。我不想让我的代码充满跟踪。

是否有一种方法可以使gdb在此错误时中断?

深入lua源代码,我发现"尝试索引nil值"消息来自函数luaG_typeerror(来自ldebug.c)。

所以进入luaG_typerror就足够了。