ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Bug Reports (https://www.esoui.com/forums/forumdisplay.php?f=187)
-   -   [notabug] GetAchievementTimestamp(number achievementId) returns wrong datatype (https://www.esoui.com/forums/showthread.php?t=10002)

MrPikPik 12/06/21 09:18 AM

[notabug] GetAchievementTimestamp(number achievementId) returns wrong datatype
 
Hello everyone,

I noticed the function "GetAchievementTimestamp(number achievementId)" returns "wrong" values.
For my understanding the function expects a number, the id of an achievement, and should return a unix timestamp of the completion date of the given achievement or 0 if it hasn't been completed.


Calling the function for completed achievements however, the return value is a floating point number.

I did some investigation with the number the function returned: In my example, the returned number was "7.8484867882774e-315". The 64 bits of that double are "0000000000000000000000000000000001011110101011110101111011110011". When you interpret these bits as an unsigned long you get the value "1588551411", which is the actual unix timestamp of completion of the achievement I fed into the function, May 4th 2020.

Seems like the lua backend just interprets the memory as the wrong data type so the issue should be easily fixable trough some pointer-casting-magic :)

Unfortunatly I am unable to tell if this is a recent bug or if it has been in the game for longer.

I hope this is helpful for the devs :)

sirinsidiator 12/06/21 10:08 AM

That's not a bug and was actually discussed on gitter a few weeks ago.
To clarify, the documentation states that the return type is an id64 which only looks like a number, but is actually some ESO specific black magic to bring 64 bit integers to Lua:
Code:

* GetAchievementTimestamp(*integer* _achievementId_)
** _Returns:_ *id64* _timestamp_

It works differently and can only be used with certain functions that accept id64 as input, like Id64ToString:
Code:

* Id64ToString(*id64* _id_)
** _Returns:_ *string* _stringDesc_

The actual bug is that GetTimeStamp also states that it returns an id64, when in reality it returns a regular Lua number. Due to it working like that since launch and almost every addon relying on GetTimeStamp returning a 32bit integer, they won't change the type of that and will instead update the documentation to state the correct return type next update.


All times are GMT -6. The time now is 04:32 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI