← Back to Guides
PART_03

Step-by-Step Tutorial: Writing Your First Addon

Published: March 28, 2026
#Tutorial#LuaScripting#GameDev

Ready to write your own addon? We are going to build a completely from-scratch addon that logs when the addon successfully loads into the game. No third-party libraries - just pure, raw Lua code.

STEP 01The Folder & The TOC File

First, navigate to your World of Warcraft installation directory, then into _retail_\Interface\AddOns. Create a new folder named exactly what you want your addon to be called (e.g., ForgeTracker).

Inside that folder, create a plain text file named exactly the same as the folder, but with a .toc extension (e.g., ForgeTracker.toc). This "Table of Contents" file literally tells WoW how to load your addon. Open it in VS Code and paste this:

## Interface: 100206
## Title: ForgeTracker
## Notes: My very first custom WoW addon.
## Author: The Lav Forge Developer
## Version: 1.0.0

ForgeTracker.lua

Tip: The "Interface" number dictates which WoW patch this is for. You can find the current number in-game by typing /dump select(4, GetBuildInfo()) into chat.

STEP 02Writing the Lua Code

Now, create the actual code file in the same folder. Name it ForgeTracker.lua(exactly as you referenced it at the bottom of the TOC file). Open it up, and let's write your first line of WoW Lua logic:

-- This creates an invisible frame in the game to listen for eventslocal frame = CreateFrame("Frame")-- We tell the frame to listen to the exact moment the player logs inframe:RegisterEvent("PLAYER_LOGIN")-- We assign a function to fire when that event triggersframe:SetScript("OnEvent", function(self, event, ...)if event == "PLAYER_LOGIN" thenprint("|cffffcc00[ForgeTracker]|r successfully loaded!")endend)

STEP 03Execution & Testing

Save both files. Boot up World of Warcraft and click the "AddOns" button in the bottom left corner of the character select screen. You should see ForgeTracker listed! Make sure the checkbox is ticked, and enter the world.

Look at your chat box immediately upon loading. You will see a yellow message: [ForgeTracker] successfully loaded! Congratulations, you have successfully engineered a native WoW addon.

Want to build something massive?

Printing text to a chatbox is easy. Building a localized, memory-efficient WeakAura suite with custom textures that flawlessly calculates diminishing returns across an entire 40-man raid? That's what we do.

Hire Our Engineers