Game UI Functions
Overviewβ
The core.game_ui module provides functions for interacting with the World of Warcraft game interface. This includes accessing loot windows, battlefield information, cursor positions, and map utilities.
Loot Window Functions π°β
core.game_ui.get_loot_item_countβ
Syntax
core.game_ui.get_loot_item_count() -> integer
integer: The number of lootable items currently available in the loot window.
Retrieves the number of items currently available in the loot window.
Example Usage
local item_count = core.game_ui.get_loot_item_count()
core.log("Lootable items: " .. item_count)
core.game_ui.get_loot_item_idβ
Syntax
core.game_ui.get_loot_item_id(index: integer) -> integer
Parameters
index:integer- The index of the loot item.
integer: The ID of the lootable item.
Retrieves the item ID of a lootable item at the specified index.
Example Usage
local item_id = core.game_ui.get_loot_item_id(0)
core.log("First loot item ID: " .. item_id)
core.game_ui.get_loot_item_nameβ
Syntax
core.game_ui.get_loot_item_name(index: integer) -> string
Parameters
index:integer- The index of the loot item.
string: The name of the lootable item.
Retrieves the name of the lootable item at the specified index.
Example Usage
local item_name = core.game_ui.get_loot_item_name(0)
core.log("First loot item: " .. item_name)
core.game_ui.get_loot_is_goldβ
Syntax
core.game_ui.get_loot_is_gold(index: integer) -> boolean
Parameters
index:integer- The index of the loot item.
boolean:trueif the item is gold; otherwise,false.
Checks if the lootable item at the specified index is gold.
Example Usage
if core.game_ui.get_loot_is_gold(0) then
core.log("First loot slot contains gold!")
end
Loot Window - Complete Exampleβ
local function process_loot()
local count = core.game_ui.get_loot_item_count()
for i = 0, count - 1 do
if core.game_ui.get_loot_is_gold(i) then
core.log("Slot " .. i .. ": Gold")
else
local name = core.game_ui.get_loot_item_name(i)
local id = core.game_ui.get_loot_item_id(i)
core.log("Slot " .. i .. ": " .. name .. " (ID: " .. id .. ")")
end
end
end
Battlefield Functions βοΈβ
core.game_ui.get_battlefield_statusβ
Syntax
core.game_ui.get_battlefield_status(index: integer) -> string
Parameters
index:integer- The battlefield queue index.
string: The status of the battlefield queue.
Retrieves the status of a battlefield queue at the specified index.
Possible Return Values:
| Value | Description |
|---|---|
"confirm" | Battlefield is ready to join |
"queued" | Currently in queue |
"active" | Currently in the battlefield |
"error" | Error state |
"none" | Not queued |
Example Usage
local status = core.game_ui.get_battlefield_status(1)
if status == "confirm" then
core.log("Battlefield ready! Accept the queue.")
elseif status == "queued" then
core.log("Waiting in queue...")
end
core.game_ui.get_battlefield_stateβ
Syntax
core.game_ui.get_battlefield_state() -> integer
integer: The current state of the battlefield.
Retrieves the current state of the battlefield.
State Values:
| Value | Description |
|---|---|
2 | Preparation phase |
3 | Active/In progress |
5 | Finished |
Example Usage
local state = core.game_ui.get_battlefield_state()
if state == 2 then
core.log("Battlefield starting soon - preparation phase")
elseif state == 3 then
core.log("Battlefield in progress!")
elseif state == 5 then
core.log("Battlefield finished")
end
core.game_ui.get_battlefield_run_timeβ
Syntax
core.game_ui.get_battlefield_run_time() -> number
number: Timer in milliseconds since the battlefield started.
Retrieves the time elapsed since the battlefield started.
Example Usage
local run_time = core.game_ui.get_battlefield_run_time()
local minutes = math.floor(run_time / 60000)
local seconds = math.floor((run_time % 60000) / 1000)
core.log(string.format("Battlefield running for: %d:%02d", minutes, seconds))
core.game_ui.get_battlefield_winnerβ
Syntax
core.game_ui.get_battlefield_winner() -> integer|nil
integer|nil: The winner of the battlefield, ornilif no winner yet.
Retrieves the winner of the battlefield.
Return Values:
| Value | Description |
|---|---|
nil | No winner yet (match in progress) |
0 | Horde won |
1 | Alliance won |
2 | Tie |
Example Usage
local winner = core.game_ui.get_battlefield_winner()
if winner == nil then
core.log("Match still in progress")
elseif winner == 0 then
core.log("Horde wins!")
elseif winner == 1 then
core.log("Alliance wins!")
elseif winner == 2 then
core.log("It's a tie!")
end
Cursor Functions π±οΈβ
core.game_ui.get_wow_cursor_positionβ
Syntax
core.game_ui.get_wow_cursor_position() -> vec2
vec2: The cursor position in WoW UI coordinates.
Retrieves the current WoW cursor position in UI coordinates.
Example Usage
local cursor = core.game_ui.get_wow_cursor_position()
core.log(string.format("WoW Cursor: (%.2f, %.2f)", cursor.x, cursor.y))
core.game_ui.get_normalized_cursor_positionβ
Syntax
core.game_ui.get_normalized_cursor_position() -> vec2
vec2: The cursor position normalized to 0-1 range.
Retrieves the current cursor position in normalized coordinates (0-1 range).
Example Usage
local cursor = core.game_ui.get_normalized_cursor_position()
-- cursor.x and cursor.y will be between 0 and 1
core.log(string.format("Normalized Cursor: (%.3f, %.3f)", cursor.x, cursor.y))
core.game_ui.normalize_ui_positionβ
Syntax
core.game_ui.normalize_ui_position(pos: vec2) -> vec2
Parameters
pos:vec2- The UI position to normalize.
vec2: The normalized position (0-1 range).
Normalizes a UI position to the 0-1 range.
Example Usage
local ui_pos = vec2.new(960, 540)
local normalized = core.game_ui.normalize_ui_position(ui_pos)
core.log(string.format("Normalized: (%.3f, %.3f)", normalized.x, normalized.y))
Map Functions πΊοΈβ
core.game_ui.get_current_map_idβ
Syntax
core.game_ui.get_current_map_id() -> integer
integer: The ID of the current map.
Retrieves the ID of the current map from the game UI context.
Example Usage
local map_id = core.game_ui.get_current_map_id()
core.log("Current UI map ID: " .. map_id)
core.game_ui.is_map_openβ
Syntax
core.game_ui.is_map_open() -> boolean
boolean:trueif the world map is currently open; otherwise,false.
Checks whether the world map UI is currently open.
Example Usage
if core.game_ui.is_map_open() then
core.log("Map is open - player is checking their location")
else
core.log("Map is closed")
end
Example: Pause Navigation While Map Open
local function update_navigation()
-- Don't process movement while player is looking at the map
if core.game_ui.is_map_open() then
return
end
-- Continue with navigation logic...
movement:process()
end
core.game_ui.get_world_pos_from_map_posβ
Syntax
core.game_ui.get_world_pos_from_map_pos(map_id: integer, map_pos: vec2) -> vec2
Parameters
map_id:integer- The map ID.map_pos:vec2- The position on the map (normalized 0-1 coordinates).
vec2: The X/Y world position (Z height not included).
Converts a map position to world coordinates. Returns a vec2 with X and Y in 3D world format - note that the Z (height) component is not included.
Example Usage
local map_id = core.game_ui.get_current_map_id()
local map_pos = vec2.new(0.5, 0.5) -- Center of the map
local world_pos = core.game_ui.get_world_pos_from_map_pos(map_id, map_pos)
core.log(string.format("World position: (%.2f, %.2f)", world_pos.x, world_pos.y))
-- To get the Z coordinate, use:
local full_pos = vec3.new(world_pos.x, world_pos.y, 0)
local height = core.get_height_for_position(full_pos)
core.game_ui.get_map_top_leftβ
Syntax
core.game_ui.get_map_top_left() -> vec2
vec2: The top-left corner of the world map frame in UI coordinates.
Returns the top-left corner position of the world map frame in UI coordinates.
core.game_ui.get_map_bottom_rightβ
Syntax
core.game_ui.get_map_bottom_right() -> vec2
vec2: The bottom-right corner of the world map frame in UI coordinates.
Returns the bottom-right corner position of the world map frame in UI coordinates.
core.game_ui.ui_pos_to_screen_posβ
Syntax
core.game_ui.ui_pos_to_screen_pos(ui_pos: vec2) -> vec2
Parameters
ui_pos:vec2- The position in UI coordinates.
vec2: The corresponding screen-space position in pixels.
Converts a UI-space position to screen-space pixel coordinates.
core.game_ui.world_pos_to_map_pos_normalizedβ
Syntax
core.game_ui.world_pos_to_map_pos_normalized(world_pos: vec3) -> vec2
Parameters
world_pos:vec3- A world position.
vec2: The normalized map position (0-1 range).
Converts a 3D world position to normalized map coordinates.
UI Scale Functions πβ
core.game_ui.get_effective_scaleβ
Syntax
core.game_ui.get_effective_scale() -> number
number: The effective UI scale factor.
Retrieves the effective UI scale factor. This is used internally to convert between raw UI coordinates and screen-space coordinates.
Example Usage
local scale = core.game_ui.get_effective_scale()
core.log("Effective UI scale: " .. scale)
Vendor Functions πͺβ
core.game_ui.get_vendor_item_countβ
Syntax
core.game_ui.get_vendor_item_count() -> integer
integer: The total number of items the current vendor has for sale.
Returns how many items the currently open vendor window contains.
Example Usage
local count = core.game_ui.get_vendor_item_count()
core.log("Vendor has " .. count .. " items for sale")
core.game_ui.get_vendor_item_infoβ
Syntax
core.game_ui.get_vendor_item_info(vendor_item_id: integer) -> vendor_item_info
Parameters
vendor_item_id:integer- The 1-based index of the vendor item.
vendor_item_info: A table containing the vendor item details.
vendor_item_info Properties:
| Field | Type | Description |
|---|---|---|
cost | integer | The cost of the item in copper |
is_usable | boolean | Whether the item is usable by the player |
item_id | integer | The item ID |
item_name | string | The name of the item |
quantity | integer | The quantity available |
vendor_item_index | integer | The vendor slot index |
Retrieves detailed information about a specific vendor item. The vendor_item_id parameter is 1-indexed (internally adjusted to 0-indexed).
Example Usage
local count = core.game_ui.get_vendor_item_count()
for i = 1, count do
local info = core.game_ui.get_vendor_item_info(i)
local gold = math.floor(info.cost / 10000)
local silver = math.floor((info.cost % 10000) / 100)
core.log(string.format("%s - %dg %ds (qty: %d)", info.item_name, gold, silver, info.quantity))
end
Death & Resurrection Functions πβ
core.game_ui.get_resurrect_corpse_delayβ
Syntax
core.game_ui.get_resurrect_corpse_delay() -> number
number: The delay in seconds before resurrection is possible.
Retrieves the remaining time before the player can resurrect at their corpse.
Example Usage
local delay = core.game_ui.get_resurrect_corpse_delay()
if delay > 0 then
core.log("Can resurrect in " .. delay .. " seconds")
else
core.log("Ready to resurrect!")
end
core.game_ui.get_corpse_positionβ
Syntax
core.game_ui.get_corpse_position() -> vec3
vec3: The position of the player's corpse.
Retrieves the position of the player's corpse as a 3D vector.
Example Usage
local corpse_pos = core.game_ui.get_corpse_position()
core.log(string.format("Corpse at: (%.2f, %.2f, %.2f)", corpse_pos.x, corpse_pos.y, corpse_pos.z))
-- Calculate distance to corpse
local player = core.object_manager.get_local_player()
if player then
local player_pos = player:get_position()
local distance = player_pos:dist_to(corpse_pos)
core.log("Distance to corpse: " .. string.format("%.1f", distance) .. " yards")
end
Quest Log Functions πβ
core.game_ui.get_quest_log_countβ
Syntax
core.game_ui.get_quest_log_count() -> integer
integer: The total number of entries in the quest log (including headers).
Returns the total number of entries in the quest log. This count includes both quest entries and zone header entries.
Example Usage
local count = core.game_ui.get_quest_log_count()
core.log("Quest log entries: " .. count)
core.game_ui.get_quest_log_infoβ
Syntax
core.game_ui.get_quest_log_info(quest_log_id: integer) -> quest_log_info
Parameters
quest_log_id:integer- The 1-based index of the quest log entry.
quest_log_info: A table containing the quest log entry details.
quest_log_info Properties:
| Field | Type | Description |
|---|---|---|
title | string | The title of the quest |
level | integer | The level of the quest |
suggested_group | string | The suggested group size for the quest |
is_header | boolean | Whether this entry is a header (zone name) rather than a quest |
is_collapsed | boolean | Whether this header is collapsed |
is_complete | integer | Quest completion status (1 = complete, -1 = failed, 0 = in progress) |
frequency | integer | The quest frequency (0 = normal, 1 = daily, 2 = weekly) |
quest_id | integer | The unique quest ID |
start_event | boolean | Whether the quest has a start event |
display_quest_id | boolean | Whether the quest ID should be displayed |
is_on_map | boolean | Whether the quest is shown on the map |
has_local_poi | boolean | Whether the quest has a local point of interest |
is_task | boolean | Whether the quest is a bonus objective / world quest task |
is_bounty | boolean | Whether the quest is a bounty (emissary) quest |
is_story | boolean | Whether the quest is part of the zone story line |
is_hidden | boolean | Whether the quest is hidden |
is_scaling | boolean | Whether the quest scales with the player's level |
Retrieves detailed information about a quest log entry. The quest_log_id parameter is 1-indexed (internally adjusted to 0-indexed). Note that quest log entries include both zone headers and actual quests β use is_header to distinguish between them.
Example Usage
local count = core.game_ui.get_quest_log_count()
for i = 1, count do
local info = core.game_ui.get_quest_log_info(i)
if info.is_header then
core.log("--- " .. info.title .. " ---")
else
local status = info.is_complete == 1 and "COMPLETE" or "In Progress"
core.log(string.format(" [%d] %s (Lv %d) - %s", info.quest_id, info.title, info.level, status))
end
end
core.game_ui.get_all_completed_quest_idsβ
Syntax
core.game_ui.get_all_completed_quest_ids() -> integer[]
integer[]: An array of completed quest IDs.
Returns a list of all quest IDs the player has completed. This queries the server's completed quest history, not just the current quest log.
Example Usage
local completed = core.game_ui.get_all_completed_quest_ids()
core.log("Total completed quests: " .. #completed)
-- Check if a specific quest was completed
local target_quest_id = 12345
for _, quest_id in ipairs(completed) do
if quest_id == target_quest_id then
core.log("Quest " .. target_quest_id .. " has been completed!")
break
end
end
Complete Examples πβ
Example: Auto-Loot Systemβ
local function auto_loot()
local count = core.game_ui.get_loot_item_count()
if count == 0 then return end
for i = 0, count - 1 do
-- Always loot gold
if core.game_ui.get_loot_is_gold(i) then
core.input.loot_item(i)
else
local item_id = core.game_ui.get_loot_item_id(i)
-- Add your item filter logic here
if should_loot_item(item_id) then
core.input.loot_item(i)
end
end
end
end
Example: Battlefield Status Monitorβ
local function check_battlefield_status()
-- Check all queue slots
for i = 1, 3 do
local status = core.game_ui.get_battlefield_status(i)
if status == "confirm" then
core.graphics.add_notification(
"bg_ready_" .. i,
"Battlefield Ready!",
"Queue " .. i .. " is ready to join",
5000,
color.new(0, 255, 0, 255)
)
end
end
-- If in battlefield, show timer
local state = core.game_ui.get_battlefield_state()
if state == 3 then -- Active
local run_time = core.game_ui.get_battlefield_run_time()
local minutes = math.floor(run_time / 60000)
local seconds = math.floor((run_time % 60000) / 1000)
-- Display timer...
end
end
Example: Corpse Run Helperβ
local function corpse_run_helper()
local player = core.object_manager.get_local_player()
if not player or not player:is_dead() then return end
local corpse_pos = core.game_ui.get_corpse_position()
local player_pos = player:get_position()
local distance = player_pos:dist_to(corpse_pos)
-- Draw line to corpse
core.graphics.line_3d(player_pos, corpse_pos, color.new(255, 255, 0, 200), 2)
-- Draw circle at corpse
core.graphics.circle_3d(corpse_pos, 5, color.new(255, 255, 0, 200), 2)
-- Show distance
local screen_pos = core.graphics.w2s(corpse_pos)
if screen_pos then
core.graphics.text_2d(
string.format("%.0f yards", distance),
screen_pos,
16,
color.new(255, 255, 255, 255),
true
)
end
-- Check resurrection delay
local delay = core.game_ui.get_resurrect_corpse_delay()
if delay > 0 then
core.log("Wait " .. delay .. " seconds to resurrect")
end
end
Example: Vendor Auto-Buyβ
local function buy_from_vendor(item_name, quantity)
local count = core.game_ui.get_vendor_item_count()
for i = 1, count do
local info = core.game_ui.get_vendor_item_info(i)
if info.item_name == item_name and info.is_usable then
core.input.buy_item(i, quantity)
local gold = math.floor(info.cost * quantity / 10000)
core.log(string.format("Bought %dx %s for %dg", quantity, item_name, gold))
return true
end
end
core.log("Item not found at vendor: " .. item_name)
return false
end
Instance Functions πβ
core.game_ui.reset_instancesβ
Syntax
core.game_ui.reset_instances() -> nil
Resets all instances for the local player.
Example Usage
core.game_ui.reset_instances()
core.log("All instances have been reset")
Tooltip Functions π¬β
core.game_ui.get_tooltip_infoβ
Syntax
core.game_ui.get_tooltip_info() -> tooltip_info
tooltip_info: A table containing the current tooltip information.
tooltip_info Properties:
| Field | Type | Description |
|---|---|---|
type | string | The tooltip type: "unit", "spell", "item", or "" |
id | integer | The ID of the tooltip subject |
name | string | The name of the tooltip subject |
num_lines | integer | The number of lines in the tooltip |
Retrieves information about the currently displayed tooltip.
Example Usage
local info = core.game_ui.get_tooltip_info()
if info.type ~= "" then
core.log(string.format("Tooltip: %s - %s (ID: %d)", info.type, info.name, info.id))
end
core.game_ui.setup_tooltip_processorβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.setup_tooltip_processor() -> boolean
boolean:trueif the tooltip processor was set up successfully,falseotherwise.
Sets up the tooltip data processor hook for displaying IDs in tooltips.
Example Usage
local success = core.game_ui.setup_tooltip_processor()
if success then
core.log("Tooltip processor initialized")
end
core.game_ui.set_tooltip_npc_idβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.set_tooltip_npc_id(npc_id: integer) -> nil
Parameters
npc_id:integer- The NPC ID to set as fallback for the tooltip processor.
Sets a fallback NPC ID for the tooltip processor.
Example Usage
core.game_ui.set_tooltip_npc_id(12345)
core.game_ui.add_tooltip_lineβ
Syntax
core.game_ui.add_tooltip_line(text: string, r?: number, g?: number, b?: number) -> nil
Parameters
text:string- The text to add to the tooltip.r(optional):number- Red color component (0.0-1.0). Defaults to 1.0.g(optional):number- Green color component (0.0-1.0). Defaults to 1.0.b(optional):number- Blue color component (0.0-1.0). Defaults to 0.0.
Adds a colored line to the GameTooltip. Default color is yellow (1.0, 1.0, 0.0).
Example Usage
core.game_ui.add_tooltip_line("Custom info line", 0.0, 1.0, 0.0)
core.game_ui.add_tooltip_double_lineβ
Syntax
core.game_ui.add_tooltip_double_line(left_text: string, right_text: string, lr?: number, lg?: number, lb?: number, rr?: number, rg?: number, rb?: number) -> nil
Parameters
left_text:string- The left-side text.right_text:string- The right-side text.lr(optional):number- Left text red component (0.0-1.0).lg(optional):number- Left text green component (0.0-1.0).lb(optional):number- Left text blue component (0.0-1.0).rr(optional):number- Right text red component (0.0-1.0).rg(optional):number- Right text green component (0.0-1.0).rb(optional):number- Right text blue component (0.0-1.0).
Adds a double-line entry to the GameTooltip with separate left and right text, each with optional color.
Example Usage
core.game_ui.add_tooltip_double_line("Item Level", "450", 1.0, 1.0, 1.0, 0.0, 1.0, 0.0)
Countdownβ
core.game_ui.do_countdownβ
Syntax
core.game_ui.do_countdown(seconds: integer) -> boolean
Parameters
seconds:integer- The countdown duration in seconds.
boolean: Whether the countdown was started successfully.
Starts a countdown timer in the party or raid group using C_PartyInfo.DoCountdown.
Example Usage
-- Start a 10 second countdown
local success = core.game_ui.do_countdown(10)
Talentsβ
core.game_ui.get_talent_infoβ
Syntax
core.game_ui.get_talent_info(arg1: integer, arg2: integer, arg3?: integer) -> table
Parameters
arg1:integer- Tab index (Classic) or tier (Retail).arg2:integer- Talent index (Classic) or column (Retail).arg3(optional):integer- Is inspect flag (Classic) or spec group index (Retail).
table: Talent information. Fields vary by game version:
Classic fields:
| Field | Type | Description |
|---|---|---|
name | string | The talent name |
texture | integer | The icon texture ID |
tier | integer | The talent tier |
column | integer | The talent column |
rank | integer | Current rank |
max_rank | integer | Maximum rank |
is_exceptional | boolean | Whether the talent is exceptional |
available | boolean | Whether the talent is available |
Retail fields:
| Field | Type | Description |
|---|---|---|
talent_id | integer | The talent ID |
name | string | The talent name |
texture | integer | The icon texture ID |
selected | boolean | Whether the talent is selected |
available | boolean | Whether the talent is available |
spell_id | integer | Associated spell ID |
row | integer | The talent row |
column | integer | The talent column |
known | boolean | Whether the talent is known |
Returns talent information for a given talent position. The return format is automatically detected based on the game version (Classic vs Retail).
Example Usage
-- Classic: get info for tab 1, talent 3
local info = core.game_ui.get_talent_info(1, 3)
print(info.name, info.rank .. "/" .. info.max_rank)
-- Retail: get info for tier 2, column 1, active spec
local info = core.game_ui.get_talent_info(2, 1, 1)
print(info.name, info.spell_id)
core.game_ui.get_active_talentsβ
Syntax
core.game_ui.get_active_talents() -> active_talent_entry[]
active_talent_entry[]- Array of tables, each containing:
| Field | Type | Description |
|---|---|---|
node_id | integer | The talent node ID. |
spell_id | integer | The spell ID associated with the talent. |
name | string | The talent name. |
rank | integer | The current rank purchased. |
max_rank | integer | The maximum rank available. |
Returns all active talent nodes for the player using the retail 10.0+ C_Traits API. Each entry represents a talent node with at least 1 rank purchased, including the talent rank. Returns an empty table on classic.
Example Usage
local talents = core.game_ui.get_active_talents()
for _, t in ipairs(talents) do
print(t.name, t.spell_id, t.rank .. "/" .. t.max_rank)
end
Context Menuβ
core.game_ui.show_context_menuβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.show_context_menu(items: table[]) -> nil
Parameters
items:table[]- Array of menu entries. Each entry is a table with:text:string- The button label.id:integer- The button identifier.
Shows a context menu at the cursor with simple text buttons. Uses WoW's MenuUtil.CreateContextMenu (Retail only). Poll the result with get_context_menu_result().
Example Usage
core.game_ui.show_context_menu({
{ text = "Option A", id = 1 },
{ text = "Option B", id = 2 },
{ text = "Cancel", id = 3 },
})
core.game_ui.get_context_menu_resultβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.get_context_menu_result() -> integer
integer: Theidof the clicked button, or0if nothing was clicked.
Polls the result of the last context menu shown with show_context_menu. Reading the result consumes it (one-shot) β subsequent calls return 0 until a new menu option is clicked.
Example Usage
local result = core.game_ui.get_context_menu_result()
if result == 1 then
-- Option A was clicked
elseif result == 2 then
-- Option B was clicked
end
Unit Context Menu Buttons π±οΈβ
These functions let you inject custom buttons into the right-click context menus that appear on unit frames (player, target, focus, party, raid, arena, boss, pet, vehicle). Clicks are queued and polled asynchronously.
core.game_ui.add_unit_menu_buttonβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.add_unit_menu_button(text: string) -> integer
Parameters
text:string- The button label text.
integer: The button ID, used withset_unit_menu_button_text,remove_unit_menu_button, and returned inpoll_unit_menu_clickresults.
Adds a custom button to all unit right-click context menus. The button appears for all common unit menu types (self, player, target, focus, party, raid, arena enemy, boss, pet, vehicle). Use poll_unit_menu_click() to detect when the button is clicked.
Example Usage
local btn_id = core.game_ui.add_unit_menu_button("Focus Target")
core.game_ui.set_unit_menu_button_textβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.set_unit_menu_button_text(id: integer, text: string)
Parameters
id:integer- The button ID returned byadd_unit_menu_button.text:string- The new button label text.
Updates the label of an existing unit menu button.
Example Usage
core.game_ui.set_unit_menu_button_text(btn_id, "Updated Label")
core.game_ui.remove_unit_menu_buttonβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.remove_unit_menu_button(id: integer)
Parameters
id:integer- The button ID returned byadd_unit_menu_button.
Removes a unit menu button entirely. The ID becomes orphaned and will no longer appear in context menus.
Example Usage
core.game_ui.remove_unit_menu_button(btn_id)
core.game_ui.poll_unit_menu_clickβ
Removed on May 10, 2026 in core 1.930+. This field will be nil at runtime. Do not call it.
core.game_ui.poll_unit_menu_click() -> table | nil
table | nil: The click info table, ornilif no clicks are pending. Contains:
| Field | Type | Description |
|---|---|---|
button_id | integer | The ID of the button that was clicked |
unit_token | string | The unit token (e.g. "target", "party1") |
unit_name | string | The unit's name |
unit_guid | string | The unit's GUID |
menu_tag | string | The menu context tag (e.g. "MENU_UNIT_PLAYER") |
Pops the oldest queued click from unit menu buttons. Clicks are consumed one at a time β call in a loop to drain the queue.
Example Usage
local click = core.game_ui.poll_unit_menu_click()
if click then
core.log("Button " .. click.button_id .. " clicked on " .. click.unit_name
.. " (" .. click.unit_token .. ") [" .. click.menu_tag .. "]")
end
Ping System π‘β
core.game_ui.is_ping_enabledβ
Syntax
core.game_ui.is_ping_enabled() -> boolean
boolean:trueif the ping system is currently enabled,falseotherwise.
Checks whether the in-game ping system (C_Ping) is enabled and available. Use this before calling send_ping to avoid silent failures.
Example Usage
if core.game_ui.is_ping_enabled() then
core.game_ui.send_ping()
end
core.game_ui.send_pingβ
Syntax
core.game_ui.send_ping(ping_type?, target?)
Parameters
ping_type(integer, optional): The ping type ID. Pass-1or omit for a default contextual ping.target(game_object, optional): A game object to ping on. Omit for a contextual ping at the cursor position.
Sends a ping in the game world. Can be a contextual ping (no arguments), a typed ping, or a targeted ping on a specific game object (e.g., an NPC).
Example Usage
-- Contextual ping (default)
core.game_ui.send_ping()
-- Typed ping on a specific target
local target = core.object_manager.get_object_by_index(1)
if target then
core.game_ui.send_ping(3, target)
end