[webkit-help] Using return value from Javascript in C

Alberto Pareja-Lecaros aparejal at ics.uci.edu
Sat Apr 28 16:05:59 PDT 2012


Hello,

I am attempting to take a JSValue from Javascript and turning it into a
double. I have this function in JS:

function ReturnOne()
{
  return 1;
}

and then in C I invoke JSValueToNumber in order to convert the JSValue to a
double. I have also tried:

function ReturnOne()
{
  return new Number(1);
}

But I still get a garbage value when converting to a double (a really large
negative value).

I've looked up other examples in the mailing list of calling Javascript
functions but they all end before the manipulation of the result. I know my
call is working because when I put an alert in the function, it displays
when it gets called.

Any assistance would be greatly appreciated. Thanks!

-Alberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20120428/b497f5ca/attachment.html>


More information about the webkit-help mailing list