IsObjectLootable
The IsObjectLootable function checks whether a specified object in the game world is lootable. This function is useful for determining if an object, such as a defeated enemy or a container, can be looted by the player.
Parameters
object: The object identifier (GUID) or unit identifier (such as "player", "target", "focus", etc.) for which to check lootability.
Returns
lootable: A boolean value indicating whether the specified object is lootable (trueif lootable,falseotherwise).
Example Usage in Lua
Here is an example of how to use the IsObjectLootable function in Lua:
local api = ...
-- Function to check if the target is lootable
function CheckIfTargetIsLootable()
local target = "target"
local isLootable = api.IsObjectLootable(target)
if isLootable then
print("The target is lootable.")
else
print("The target is not lootable.")
end
end
-- Function to check if a specific object by GUID is lootable
function CheckIfObjectIsLootable(objectGUID)
local isLootable = api.IsObjectLootable(objectGUID)
if isLootable then
print("The object with GUID " .. objectGUID .. " is lootable.")
else
print("The object with GUID " .. objectGUID .. " is not lootable.")
end
end
-- Call the functions
CheckIfTargetIsLootable()
-- Example object GUID (replace with an actual GUID in your game)
local exampleObjectGUID = "1234-5678-9012-3456"
CheckIfObjectIsLootable(exampleObjectGUID)