2026-03-20 11:12:07 -07:00
|
|
|
-- HelloWorld addon — test the WoWee addon system
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r Addon loaded! Lua 5.1 is working.")
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r GetTime() = " .. string.format("%.2f", GetTime()) .. " seconds")
|
feat: add core WoW Lua API functions for addon development
Add 13 WoW-compatible Lua API functions that addons can call:
Unit API: UnitName, UnitHealth, UnitHealthMax, UnitPower, UnitPowerMax,
UnitLevel, UnitExists, UnitIsDead, UnitClass (supports "player",
"target", "focus", "pet" unit IDs)
Game API: GetMoney, IsInGroup, IsInRaid, GetPlayerMapPosition
Updated HelloWorld addon to demonstrate querying player state.
2026-03-20 11:17:15 -07:00
|
|
|
|
|
|
|
|
-- Query player info (will show real data when called after world entry)
|
|
|
|
|
local name = UnitName("player")
|
|
|
|
|
local level = UnitLevel("player")
|
|
|
|
|
local health = UnitHealth("player")
|
|
|
|
|
local maxHealth = UnitHealthMax("player")
|
|
|
|
|
local gold = math.floor(GetMoney() / 10000)
|
|
|
|
|
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r Player: " .. name .. " (Level " .. level .. ")")
|
|
|
|
|
if maxHealth > 0 then
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r Health: " .. health .. "/" .. maxHealth)
|
|
|
|
|
end
|
|
|
|
|
if gold > 0 then
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r Gold: " .. gold .. "g")
|
|
|
|
|
end
|