Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi, Chris

I met an error about Lua : ILuaEx_GetField

simulator show:
SimTargetExecutor.exe has triggered a breakpoint

code:
//when run about 20 times, it will crash at:
void magic_GameRun(ILuaEx * L)
{
boolean bValue;
ILuaEx_GetGlobal(L, "mgc");
ILuaEx_IsNil(L, -1,&bValue);
if(bValue) return ;//ILuaEx_Error(L);

ILuaEx_GetField(L, -1, "run"); --------------------- error here
ILuaEx_IsNil(L, -1,&bValue);
if(bValue) return ;//ILuaEx_Error(L);
Yeti_call(L,0, 0);

But before I update the Brew MP SDK 7.6, it works OK. Is there any changes about lua library in the new release?

information:
VS2008
Brew MP SDK 7.6

thanks

Find the root cause:
//Run lua fucntion in C : mgc.run()
void magic_GameRun(ILuaEx * L)
{
boolean bValue;
ILuaEx_GetGlobal(L, "mgc");
ILuaEx_IsNil(L, -1,&bValue);
if(bValue) return ;//ILuaEx_Error(L);
ILuaEx_GetField(L, -1, "run");
ILuaEx_IsNil(L, -1,&bValue);
if(bValue) return ;//ILuaEx_Error(L);
mgcheart_call(L,0, 0);
ILuaEx_Pop(L,2); --Add this line,popup the stack everytime

Find the root cause:
//Run lua fucntion in C : mgc.run()
void magic_GameRun(ILuaEx * L)
{
boolean bValue;
ILuaEx_GetGlobal(L, "mgc");
ILuaEx_IsNil(L, -1,&bValue);
if(bValue) return ;//ILuaEx_Error(L);
ILuaEx_GetField(L, -1, "run");
ILuaEx_IsNil(L, -1,&bValue);
if(bValue) return ;//ILuaEx_Error(L);
mgcheart_call(L,0, 0);
ILuaEx_Pop(L,2); --Add this line,popup the stack everytime