WoW:API UnitGUID: Difference between revisions

280 bytes removed ,  15 April 2008
Line 72: Line 72:
  Cyan has the GUID: 0x00000000012729FD
  Cyan has the GUID: 0x00000000012729FD


<big>'''Decimal Result'''</big>
<big>'''Conversion to decimal?'''</big>


'''I believe the GUID is too large to be represented as a number, as such, this is a bad idea.''' [[User:Smariot|Smariot]] 19:33, 8 April 2008 (UTC)
GUIDs are 64-bit numbers, and are far too long to convert to decimal numbers using lua's libraries as a whole. E.g. running tonumber(guid, 16) will produce erronous results.
 
Alternatively you can also make it output the decimal value instead of the hexdecimal by doing like this:
local name = UnitName("target"); local guid = tonumber(UnitGUID("target"),16); ChatFrame1:AddMessage(name.." has the GUID: "..guid);
The above function would then return this:
Cyan has the GUID: 19343869
Anonymous user