calling outValue on object type outArgument

15 views
Skip to first unread message

mugginsoft

unread,
Apr 23, 2012, 5:43:35 PM4/23/12
to JSCocoa
Hi

Just a point of clarification.

My understanding is that outValue only needs to be called on an
outArgument if the returned type is an NSObject.
If the returned value is a basic data type (int, float etc) then the
outArgument can be used without referencing the outValue.

Is this correct?

Thanks

Jonathan


Patrick Geiller

unread,
Apr 25, 2012, 2:41:45 PM4/25/12
to jsc...@googlegroups.com
> My understanding is that outValue only needs to be called on an
> outArgument if the returned type is an NSObject.
> If the returned value is a basic data type (int, float etc) then the
> outArgument can be used without referencing the outValue.

This depends on how you use the value held by outArgument.

When you use math, eg a+b, JavascriptCore will call .valueOf() on a and b. (Same goes for strings)
If a and b are outArguments, JSCocoa will be called back and outArgument's .valueOf() will automatically call the outValue.

If you have an outArgument that holds an object and you want its outValue to go in an array, or pass it to a method, … do call the outValue (or valueOf()) on it.
Reply all
Reply to author
Forward
0 new messages