feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:
- CreateFrame(type, name, parent, template) — creates a frame table
with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name
Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.
Updated HelloWorld to use standard WoW addon pattern:
local f = CreateFrame("Frame", "MyFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
|
|
|
-- HelloWorld addon — demonstrates the WoWee addon system
|
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
|
|
|
|
2026-03-20 12:22:50 -07:00
|
|
|
-- Initialize saved variables (persisted across sessions)
|
|
|
|
|
if not HelloWorldDB then
|
|
|
|
|
HelloWorldDB = { loginCount = 0 }
|
|
|
|
|
end
|
|
|
|
|
HelloWorldDB.loginCount = (HelloWorldDB.loginCount or 0) + 1
|
|
|
|
|
|
feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:
- CreateFrame(type, name, parent, template) — creates a frame table
with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name
Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.
Updated HelloWorld to use standard WoW addon pattern:
local f = CreateFrame("Frame", "MyFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
|
|
|
-- Create a frame and register for events (standard WoW addon pattern)
|
|
|
|
|
local f = CreateFrame("Frame", "HelloWorldFrame")
|
|
|
|
|
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
|
|
|
f:RegisterEvent("CHAT_MSG_SAY")
|
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
|
|
|
|
feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:
- CreateFrame(type, name, parent, template) — creates a frame table
with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name
Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.
Updated HelloWorld to use standard WoW addon pattern:
local f = CreateFrame("Frame", "MyFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
|
|
|
f:SetScript("OnEvent", function(self, event, ...)
|
|
|
|
|
if event == "PLAYER_ENTERING_WORLD" then
|
|
|
|
|
local name = UnitName("player")
|
|
|
|
|
local level = UnitLevel("player")
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r Welcome, " .. name .. "! (Level " .. level .. ")")
|
2026-03-20 12:22:50 -07:00
|
|
|
print("|cff00ff00[HelloWorld]|r Login count: " .. HelloWorldDB.loginCount)
|
feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:
- CreateFrame(type, name, parent, template) — creates a frame table
with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name
Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.
Updated HelloWorld to use standard WoW addon pattern:
local f = CreateFrame("Frame", "MyFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
|
|
|
elseif event == "CHAT_MSG_SAY" then
|
|
|
|
|
local msg, sender = ...
|
|
|
|
|
if msg and sender then
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r " .. sender .. " said: " .. msg)
|
|
|
|
|
end
|
2026-03-20 11:23:38 -07:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:
- CreateFrame(type, name, parent, template) — creates a frame table
with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name
Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.
Updated HelloWorld to use standard WoW addon pattern:
local f = CreateFrame("Frame", "MyFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
|
|
|
-- Register a custom slash command
|
|
|
|
|
SLASH_HELLOWORLD1 = "/hello"
|
|
|
|
|
SLASH_HELLOWORLD2 = "/hw"
|
|
|
|
|
SlashCmdList["HELLOWORLD"] = function(args)
|
|
|
|
|
print("|cff00ff00[HelloWorld]|r Hello! " .. (args ~= "" and args or "Type /hello <message>"))
|
2026-03-20 12:22:50 -07:00
|
|
|
print("|cff00ff00[HelloWorld]|r Sessions: " .. HelloWorldDB.loginCount)
|
feat: add CreateFrame with RegisterEvent/SetScript for WoW addon pattern
Implement the core WoW frame system that nearly all addons use:
- CreateFrame(type, name, parent, template) — creates a frame table
with metatable methods, optionally registered as a global by name
- frame:RegisterEvent(event) — register frame for event dispatch
- frame:UnregisterEvent(event) — unregister
- frame:SetScript(type, handler) — set OnEvent/OnUpdate/etc handlers
- frame:GetScript(type) — retrieve handlers
- frame:Show()/Hide()/IsShown()/IsVisible() — visibility state
- frame:GetName() — return frame name
Event dispatch now fires both global RegisterEvent handlers AND
frame OnEvent scripts, matching WoW's dual dispatch model.
Updated HelloWorld to use standard WoW addon pattern:
local f = CreateFrame("Frame", "MyFrame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event, ...) end)
2026-03-20 11:46:04 -07:00
|
|
|
end
|
|
|
|
|
|
2026-03-20 12:22:50 -07:00
|
|
|
print("|cff00ff00[HelloWorld]|r Addon loaded. Type /hello to test.")
|