ObjectGUID

Returns the GUID of a WowGameObject. This is equal to UnitGUID but supports any object

ObjectGUID(--[[(1)]]objectReference) : string | false
  1. See Object Reference for more information on possible values.

Example

Get a units guid.

local guid = ObjectGUID('target')

Check if object is the player

local pguid = ObjectGUID('player')
return pguid == guid