[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table crash on callback
- From: "Wesley Smith" <wesley.hoke@...>
- Date: Thu, 22 Mar 2007 12:22:08 -0700
Sorry about the syntax, I was recoding short examples in email. I was
actually doing
function collisionDetection(data, o1, o2)
strings[ tostring(o1) ] = true
end
Indeed I finally figured out how to get GDB running with this thing.
I have an app hosting Lua which loads a Lua.framework and the luaODE
module.
This is where I get the bad access error:
Line 425 from ltable.c
gkey(mp)->value = key->value; gkey(mp)->tt = key->tt;
When the debugger breaks on the bad access, it show all of the
variables being out of scope.
The C function looks like this:
static void nearCallback(void *Lua, dGeomID o1, dGeomID o2)
{
lua_State *L = (lua_State *)Lua;
int top = lua_gettop(L);
if(!lua_isfunction(L, top))
luaL_error(L, " nearCallback has no function to call for collision");
//function gets popped after it's called, if the callback gets called
//more than once, it will be gone, so each time it is called, put
//a copy on the top of the stack
lua_pushvalue(L, -1);
lua_getfield(L, LUA_REGISTRYINDEX, LUA_ODE_REGISTRY_CALLBACK_DATA);
udata<dGeomID>::udata_push(L, o1);
udata<dGeomID>::udata_push(L, o2);
lua_call(L, 3, 0);
}
The crash happens on the very first call into this function. I'm not
sure where to go from here.
thanks,
wes