Forest Logo
search
package_2

data-structures-in-luau

By @fly-san

Roblox

Mirrored

Data structures in luau

Small compilation of data structures written in Luau

Ever wanted to use structures other than arrays or dictionaries in lua? Me neither. But often, using predefined data structures is faster to implement and ultimately saves precious time for programmers.

This module contains object oriented structures


A proper documentation may be created at some point in the future.

  • Data structures can be created by requiring its module, then calling it with the structure initialization arguments.

Example:

  local Queue = require(path/to/location)
  local q = Queue(5) -- Create queue with max size 5
  q:Enqueue("Hello, world!")
  q:Dequeue()
  • Methods use PascalCase, e.g. stack:Push(1)
  • Class functions use camelCase, as in Stack.tostring(stack)

Caveats

Some structures have internal Data or Size properties, but these should not be used externally under normal circumstances. Instead, you should use the provided structure API. Size can usually be obtained with :GetSize().

Installation

You can use Wally, with this repository as a dependency.

# Wally config
...
[dependencies]
DataStructures = "fly-san/data-structures-in-luau@^0.1.7"

Data Structures:

More data structures, and documentation, to come.

Stack

Linked list

Queue

Circular queue (circular buffer, ring)

Binary Heap

License

This repository is available under the MIT license.

Package Details

Install command (Click to copy)


Version

0.1.10

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.