Commits

Anonymous committed 6c5a66c

Bug fix for functions/methods that return raw pointers (doesn't include char*). The code was not dereferencing the return block memory correctly which resulted in the wrong address being pushed as lightuserdata through the bridge.

Also moved/copied some comments to the numberOf properties in ParseSupportFunction.h so I don't have to dig in the implementation.

Comments (0)

Files changed (2)

LuaCocoa/LuaFFISupport.m

 					}
 					else
 					{
-						lua_pushlightuserdata(lua_state, (void*) return_value);
+						lua_pushlightuserdata(lua_state, *(void**) return_value);
 					}
 					number_of_return_values++;
 					break;
 				}
 				default:
 				{
-					lua_pushlightuserdata(lua_state, (void*) return_value);
+					lua_pushlightuserdata(lua_state, *(void**) return_value);
 					number_of_return_values++;
 					break;
 				}

LuaCocoa/ParseSupportFunction.h

 @property(retain, readonly) NSMutableArray* argumentArray;
 //@property(retain, readonly) NSMutableArray* flattendArgumentRepresentationArray;
 
+
+// Note: These numberOf* properties have varying degrees of computation/processing under the hood.
+
+// The number of arguments to a function.
 @property(assign, readonly) NSUInteger numberOfRealArguments;
+// Only counts flattened arguments with null terminator.
+// Does not include real arguments in the count.
 @property(assign, readonly) NSUInteger numberOfFlattenedArguments;
+// Basically the number of structs in the list
 @property(assign, readonly) NSUInteger numberOfRealArgumentsThatNeedToBeFlattened;
 
 @property(assign, readonly) NSUInteger numberOfFlattenedReturnValues;