Skip to content

Lua Dev Environment

Benjamin Staneck edited this page Apr 12, 2021 · 8 revisions

Setting up the environment

Clone the Repository

Clone the WeakAuras repository anywhere, using your favorite Git Repository app with the URL https://github.com/WeakAuras/WeakAuras2.git, or use this command in your favorite CLI:

git clone https://github.com/WeakAuras/WeakAuras2.git

Note: we don't recommend cloning the repository anywhere in the World of Warcraft folder directly. See below for directions on how to load your dev environment in World of Warcraft.

Setup Libraries

WeakAuras source code (with one exception) does not have any external libraries checked directly into the repository. Thus you will need to get these libraries and drop them into ./WeakAuras/Libs/ manually. The simplest way to do this is to download a packaged release (e.g. from one of these links), and copy the libraries from there into your repository.

Create Symlinks

In order to load your working copy of WeakAuras in WoW, you will need to have the addon "installed" just like if you install any addon in WoW. Fortunately this is fairly simple to set up by creating directory symbolic links in Interface/Addons/ which points to each of the addons in this repository. You will need to create 4 such symlinks for WeakAuras for Retail WoW, and 2 for WeakAuras Classic:

  • WeakAuras
  • WeakAurasOptions
  • WeakAurasTemplates (Retail only)
  • WeakAurasModelPaths (Retail only)

Windows:

> mklink /d "path\to\World of Warcraft\_retail_\Interface\Addons\WeakAuras" "path\to\repository\WeakAuras"
symbolic link created for WeakAuras <<===>> path\to\repositoy\WeakAuras

Create Multiple Worktrees

This step is optional, and is helpful only if you intend on developing for both WeakAuras Retail and WeakAuras Classic. Since we do not ship the same code for these versions of WeakAuras, the setup is slightly different. Happily, git has a feature which was developed for just this kind of scenario, git-worktree:

# in your WeakAuras repository:
git worktree add ../WeakAuras-classic

This will create a new worktree which is attached to the same repository. You can now set this worktree up for Classic development, while still having your original worktree set up for Retail development. Git operations such as push, pull, add, rm, commit all work exactly as you'd normally expect, with the one exception that git switch may sometimes fail if the branch you are switching to is already checked out on a different worktree. git switch --ignore-other-worktrees may be used to override this.

A proper Editor

There are of course several good editors out there for Lua development, but we suggest using Atom or Visual Studio Code since they have tons of good plugins available for Lua/WoW dev.

Atom

Visual Studio Code

Installing a Linter

Luacheck, which also serves as a static analyzer, is the Lua Linter to use and WeakAuras comes with a .luacheckrc config file that tells it what to look for and it will point out any mistakes you may make.

You can download a statically linked binary with all deps included from here and put it somewhere on your PATH.

Getting a plugin for your editor

Atom

Visual Studio Code

  • Base Linter: Not needed.
  • Plugins:
    • For Luacheck: Not needed, comes with vscode-lua.
Clone this wiki locally