Skip to main content

reforged-ts

TypeScript Wrappers and Systems over the Lua API of Warcraft III Reforged, for custom maps compiled to Lua with typescript-to-lua. A Wrapper owns one Handle and exposes its Natives as typed members (Unit, Timer, Frame); a System is a utility that wraps no Handle (sync, host, file). A fork of cipherxof/w3ts targeting Warcraft III 3.0.0 and later.

Supported Patch: 3.0.0.24268.

Install​

pnpm add reforged-ts@next reforged-types@next
pnpm add -D typescript-to-lua @typescript-to-lua/language-extensions
pnpm add -D eslint-plugin-reforged@next

Until 1.0.0, every version is an alpha published under the next dist-tag; drop @next from 1.0.0. Getting started goes through the Template, which sets up the compiler, the Typings and the lint rules for you.

Example​

import { Init, on, UnitEvents } from "reforged-ts";

Init.onTriggers(() => {
on(UnitEvents.death, ({ unit, killer }) => {
// killer is undefined for a unit that died without one
if (killer !== undefined) {
print(`${killer.name} killed ${unit.name}`);
}
});
});

Where to go next​