Standard Library

Last updated: October 07, 2021
Standard Library Edit page

WurstScript Standard Library

SOURCECODE ON GITHUB

Intro

The WurstScript standard library provides a vast amount of useful packages to developers starting out with Wurst. Many commonly used data structures, wc3-specific utility packages, Object Editing, and extension wrappers for the blizzard natives have been implemented. These tools are unit tested, and ready to use in production immediately.

Its goal is to abstract away Warcraft III’s complexity and give you bootstrapped, ready-to-use data structures and native wrappers, so you can focus on your map’s content instead of boilerplate.

This documentation aims to be an informal, detailed description of packages from the standard library, containing more examples, potentially images, further links and looks behind the scenes than the in-package hotdoc. Hotdoc in nature should be short and precise, providing concise documentation about single entities, such as a function. It should contain only one or very few usages examples to illustrate the API.

Both hotdoc and these pages should be used in conjuction for a quick familiarisation with the standard library and wurst best practises. All packages in the standard library follow the coding conventions and should be inspected for guidance and inspiration for writing your own code.

📚 Browse the full API Reference Every package, auto-generated from the in-source hotdoc. The guide below groups the most important packages by what you are trying to do.

Find the right package

  Generate WC3 object data from code

Wurst is code-first. Instead of clicking through the old Object Editor and committing binary war3map.w3* files, you define abilities, units, items, buffs and upgrades in code. You get version control, code reuse, generated IDs that cannot collide, and object data that is defined at compile time and available to your code at runtime.

  Browse all Object Editing packages

  Pick a data structure

The library ships bootstrapped, generic collections. Use this table to choose:

Package Use this when
LinkedList Your default list, stack or queue. Most versatile, fast at common operations.
HashList You need fast contains or random access on big lists.
HashMap You map keys to values, including attaching data to handles via TypeCasting.
HashSet You need uniqueness, so each element appears at most once.
BitSet You need a compact set of boolean flags.
ArrayList You want array-backed storage with high throughput.

  Browse all Data Structure packages

  Closures: events, groups & timers

React and schedule with lambdas instead of boilerplate trigger plumbing.

  Browse all Closure packages

  Warcraft III engine wrappers

Reliable, battle-tested building blocks for common Warcraft III systems.

  Browse Event, Dummy & Util packages

  Math & geometry

  Browse all Math packages

  Everything else

Files & networking, sound, terrain, printing, colors, and the full set of native handle wrappers (unit, item, player) round out the library.

  Browse the complete API Reference