Library evolution

Data Structures

Building one idea in three languages shows what the idea is.

Figure

fig. 1 — The same question came up in every version: what belongs in the structure and what belongs at the call site?

Project note

A collection moved from Lua to TypeScript to typed Luau as the tools and API needs changed.

The project

This collection has tested data structures for Roblox games. It has sorted arrays and LRU caches. It also has priority queues, random picks, simple tries, and UTF-8 tries.

It’s also the newest version of one idea, built in Lua, TypeScript, and typed Luau. Each version had its own type system, standard library, and users. Those limits changed the API. The core problems stayed the same.

The evolution

The Lua version found the set of structures people needed. The TypeScript version tried stronger type contracts and more utilities. The Luau library brings those lessons back to Roblox, where they help most. The package includes generated docs and tests.

A rewrite doesn’t always improve things. Here, the history shows which parts carried over to each language. It also shows which parts were accidents of an older version.

What it demonstrates

  • Data structures built in three language environments.
  • API polish through repeated real use.
  • Tests and docs for code that other code depends on.
  • A habit of revisiting old work instead of keeping it out of sentiment.