Skip to content
ForeverModsIDEAS IN. ADDONS OUT.Open the forge
LUA BASICS

WoW addon Lua basics: files, frames, and saved settings

You can build with plain-language prompts and still understand the files you download. A few basic concepts make it easier to review the AI’s work and explain exactly what you want to change.

THE QUICK ANSWER

The TOC describes what loads. Lua defines behavior. Frames organize the UI, events trigger reactions, and saved variables preserve explicitly declared data.

The TOC is the loading manifest

A typical small addon has a folder, a TOC file, and one or more Lua files. The TOC includes metadata and lists the source files the client should load. File order matters when one file uses something defined by another.

The Lua file contains the addon’s logic. Larger addons may also include XML, textures, or libraries. ForeverMods shows the generated files in Source code and includes them in the download, so you can inspect what is actually being installed.

MyAddon/
  MyAddon.toc   -- metadata and load order
  MyAddon.lua   -- interface and behavior

A frame is a UI object, not necessarily a window

Frames provide structure for interface elements. A frame can organize child elements and respond to interactions without drawing a visible border or background. Text and textures can be arranged into a small signal rather than a rectangular panel.

When you ask for a design change, describe the visible result: remove the background, shrink the icon, move the label below it, or make the whole group draggable. You do not need to specify every API call to request a clear layout.

Events and commands decide when code runs

Some addon behavior runs when it loads. Other behavior waits for a game event, a button click, or a slash command. This explains why an addon can load successfully and show nothing until the intended trigger happens.

If you want an always-visible element, say so. If you want a panel opened by a command, include the command in your prompt and test it. Ask for event-driven updates where possible instead of repeatedly rebuilding the same UI on every frame.

Persistence must be designed explicitly

A note or window position held only in memory will not necessarily survive a login. An addon needs an appropriate saved-variable declaration and logic to initialize, read, and update its saved data.

Decide which settings belong to the character and which should be shared within the local account. Then test with existing data as well as a fresh installation. A preview session is not a substitute for reloading the actual game to verify persistence.

Use errors as specific editing instructions

A syntax check catches malformed Lua, but it cannot establish that every function exists in the target client. Runtime errors often identify a file and a line that narrow down the failure.

Copy the complete error and describe the action that caused it. Ask the builder to preserve the rest of the addon while fixing that behavior. After the edit, repeat the original action and one normal workflow to check for regressions. Keep the last working version available as a backup.