wax crashes when calling method with a float parameter #28

LearnCocos2D opened this Issue Mar 3, 2011 · 0 comments

1 participant


This crashes with EXC_BAD_ACCESS:

[luaEntity onUpdateEveryFrame:delta];

delta is a float .. the call works perfectly fine if I wrap delta in an NSNumber object.

luaEntity is a ObjC class derived from ObjC class LuaObject
with wax_Class{"entity", "LuaEntity"} I created a subclass of LuaEntity to which this message is supposed to be sent. In case this makes any difference.

The call stack goes like this:

#0 0x019e9a60 in objc_msgSend
#1 0x000431ea in wax_fromInstance at wax_helpers.m:201
#2 0x0004306b in wax_fromObjc at wax_helpers.m:164
#3 0x00047b1c in pcallUserdata at wax_instance.m:576
#4 0x00047e82 in wax_id_call at wax_instance.m:627
#5 0x00003b6b in -[ScriptEntity update:] at ScriptEntity.m:62

The offending line where it crashes is the isKindOfClass line from this snippet:

void wax_fromInstance(lua_State *L, id instance) {
if (instance) {
if ([instance isKindOfClass:[NSString class]]) {

I think what's going on is that wax assumes the float parameter to be an id which eventually leads to the crash (trying to send isKindOfClass to a float, ouch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment