1. I don't know if the GUID format has changed or if it was just a typo but

    in

     function GUIDToType(guid)
        local typeMask = 0x00F
        local upper = tonumber(guid:sub(1, 5))
        local type = bit.band(upper, typeMask)
        if type == 0 then
           print("GUID "..guid.." is a player")
        elseif type == 3 then
           print("GUID "..guid.." is an NPC")
        elseif type == 4 then
           print("GUID "..guid.." is an NPC")
        end
     end
     GUIDToType(UnitGUID("target"))
    

    the player has not been identified correctly.

    instead i used

     if type == 8 then 
     print("GUID"..guid.." is a player")
    

    this worked.

    It's possible that the GUID format and decoding have changed, thanks for the report.

    Actually this code works properly for me, I can't reproduce your issue. What are you unable to identify?

    Actually when i ran it in WoWLua, targeted a player or used UnitGUID("player") it did not print anything when i put 0, when i put 8 it returned "... is a player" when targeting a player. Not sure how it can work for you but not for me hmz.

    Actually when i ran it in WoWLua, targeted a player or used UnitGUID("player") it did not print anything when i put 0, when i put 8 it returned "... is a player" when targeting a player. Not sure how it can work for you but not for me hmz.

    I copied the code as you put above exactly, and it worked properly. Perhaps you could post the GUID of your player, which seems to not be working with this function?

    /dump UnitGUID("player")

    /dump UnitGUID("player") says :

    Dump: value=UnitGUID("player") [1]="0x048000000315C320"

    I believe the typeMask actually needs to be 0x007, not 0x00F. I will update the errata, thanks.

    i thank you for your responses