Lua_getglobal崩溃程序
lua_getglobal crashing program
我以前写过一篇关于从c中调用lua函数的文章,你可以在这里看看:
Lua:获取全局函数失败后加载文件
如您所见,我正在加载lua文件,然后尝试获取函数并调用它。一位读者建议我解决这个问题的方法是更改为dofile而不是load file,因为您需要执行脚本来访问这些函数。但这不是目前的问题……
无论使用dofile还是loadfile,当我调用lua_getglobal(L, "abc");
我的程序崩溃了
Callstack:
> Translation.exe!luaS_newlstr(lua_State * L=0xcccccccc, const char * str=0x00460924, unsigned int l=3) Line 84 + 0x3 bytes C
Translation.exe!lua_getfield(lua_State * L=0xcccccccc, int idx=-10002, const char * k=0x00460924) Line 551 + 0x20 bytes C
Translation.exe!LanguageShovel::FileFound(std::basic_string<char,std::char_traits<char>,std::allocator<char> > path="C:LoudResolutionorchidsourceEAWResolutionApplication.cpp") Line 32 + 0x16 bytes C++
崩溃:
for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)];
o != NULL;
o = o->gch.next) {
在Lua库的lstring.c文件中。我不知道在这个lua源代码中到底发生了什么。你觉得会是lua bug吗?还是我做错了?
L=0xcccccccc
表明您没有将Lua状态变量正确地传递给此函数(或者它在您的lua_open
和lua_getglobal
调用之间丢失了)。
相关文章:
- 程序崩溃并显示"std::out_of_range"错误
- 试图创建流或fopen时程序崩溃
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 如何找出应用程序崩溃的原因 - Win 10 LTSB
- 操纵安卓相机的深度图导致应用程序崩溃
- 为什么当我尝试搜索双链表中第一个数据条目之外的数据时,程序崩溃了?
- DLL Made with CMake 使程序崩溃
- 程序崩溃使用boost::asio
- 调用 free() 有时会导致程序崩溃
- 邮件加密程序崩溃
- 调用 java 的回调() 时应用程序崩溃.由于 detatchThread 而获得运行时错误
- 比较迭代器会使程序崩溃,而不会在自定义气泡排序实现中出现错误
- For 循环在尝试读取数组 c++ 时程序崩溃
- 即使有 0 个错误,Getter 似乎也会使程序崩溃
- Windows桌面程序保存您的计算机会话 - 基于程序崩溃时的恢复会话
- 无法访问的代码如何导致我的程序崩溃?
- 矢量迭代器在尝试调用函数时使我的程序崩溃
- QCompleter set模型使应用程序崩溃
- 使用唯一指针调用函数会使我的程序崩溃
- 删除SDL_PollEvent时程序崩溃