mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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.
18 lines
745 B
Lua
18 lines
745 B
Lua
-- 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")
|
|
|
|
-- 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
|