You are not logged in.
Pages: 1
I think jsval.asDouble have some problem, if I set a double it works:
function test(aData: double): double; <-- aData = 200.45
var
myvar: jsval;
begin
myvar.asDouble := aData;
Result myvar.asDouble <-- return 200.45
end;
but if I set a integer it doesn't work:
function test(aData: double): double; <-- aData = 200
var
myvar: jsval;
begin
myvar.asDouble := aData;
Result myvar.asDouble <-- return NAN
end;
I know that I can use jsval.asInteger but in my case I don't know if entry variable is a integer or double (generally it is double but in some case an integer). Anyhow I think asDouble should handle this.
Offline
Setter works correctly - there is an if inside setter and in case actual value is integer we assign int to jsval and set a jsval type to int.
So before use a getter you should check the actual variable type
if myvar.isDouble then
myvar.asDouble
else if myvar.isInteger then
myvar.asInteger
else
throw
Offline
Pages: 1