@rbxts/linked-lists
v1.0.4
Published
A module that provides basic linked list data structures.
Downloads
12
Readme
Linked Lists
Linked Lists is a module that provides basic linked list data structures.
Installation
roblox-ts
Simply install to your roblox-ts project as follows:
npm i @rbxts/linked-lists
Wally
Wally users can install this package by adding the following line to their Wally.toml
under [dependencies]
:
LinkedLists = "bytebit/[email protected]"
Then just run wally install
.
From model file
Model files are uploaded to every release as .rbxmx
files. You can download the file from the Releases page and load it into your project however you see fit.
From model asset
New versions of the asset are uploaded with every release. The asset can be added to your Roblox Inventory and then inserted into your Place via Toolbox by getting it here.
Documentation
Documentation can be found here, is included in the TypeScript files directly, and was generated using TypeDoc.
Example
Below is a simple example showing the use of a singly-linked list to implement a queue:
import { SinglyLinkedList } from "@rbxts/linked-lists";
export class Queue {
private readonly linkedList = new SinglyLinkedList<defined>();
public push(value: defined) {
this.linkedList.pushToTail(value);
}
public pop() {
return this.linkedList.popHeadValue();
}
}
local SinglyLinkedList = require(path.to.modules["linked-lists"]).SinglyLinkedList
local Queue = {}
Queue.__index = Queue
function new()
local self = {}
setmetatable(self, Queue)
self.linkedList = SinglyLinkedList.new()
return self
end
function Queue:push(value)
self.linkedList:pushToTail(value)
end
function Queue:pop()
return self.linkedList:popHeadValue()
end
return {
new = new
}