Calls to ObjC functions with const pointer arguments fail #31

LearnCocos2D opened this Issue Mar 5, 2011 · 0 comments


None yet
1 participant

I'm calling this method from Lua:
self:setBackgroundColor{red = 0.1, green = 0.2, blue = 0.3, alpha = 1}

If the method is declared to take a const NSDictionary* like so the call fails:
-(void) setBackgroundColor:(const NSDictionary*)dict

Error calling 'onInit' on lua object '<Scene: 0x714d5d0>'
[string "waxClass{'Scene', ObjcScene};function ..."]:2: 
Unable to get type for Obj-C method argument with type description 'r@'

Declaring the method to take a non-const NSDictionary* works:
-(void) setBackgroundColor:(NSDictionary*)dict

In this case it's not tragic because I can just remove the const. But I imagine there may be methods in the iOS SDK or other 3rd party libraries taking const pointers where this would fail.

Looks like wax_copyToObjc needs a WAX_TYPE_CONST_ID switch case.

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