SReject / JSON-For-Mirc

JSON parser for mIRC
19 stars 6 forks source link

$json().value return invaild numeric value #15

Closed westor7 closed 7 years ago

westor7 commented 7 years ago

Hello,

When i use this code it returns different value from that the API has, check the test code to see by your self.

it should return 5.7 it returns now: 5.700000

Test code: http://www.mpaste.com/p/8Un Debug info: http://www.mpaste.com/p/cOyCD

SReject commented 7 years ago

This is the result of mIRC incorrectly parsing floating-point decimals returned by the com interface. I have submitted a bug report to Khaled/mIRC but have also created a work around as of commit https://github.com/SReject/JSON-For-Mirc/commit/81657ff1339282e5ac79cf2988d2ff0aa68119bf

As a reminder, please include your mIRC version and JSON For mIRC version when creating issues

westor7 commented 7 years ago

It seems that in 7.46.417 (beta) the mIRC part problem has been fixed, this problem only appear in 7.46 stable version. (as i had ;comment out the fixed commit you have done in the .js file and the results was correct with the previously .js file)

SReject commented 7 years ago

The fix for 7.46 is correct as far as I can tell. using the following I get 5.7:

;; Called to make sure the new js file is loaded
;; Only needs to be called if the .js file is updated such as to apply this hotfix
JSONShutDown

;; Example that returns 5.7
JSONOpen -d example {"a": 5.7}
echo -a Value: $JSON(example, a).value
westor7 commented 7 years ago

Yes, you're right i didn't force to update the elements in order to test the new .js fixed file.

It has been fixed and working great!