https://github.com/bytebit-org/roblox-linkedlists
A module that provides basic linked list data structures.
https://github.com/bytebit-org/roblox-linkedlists
Last synced: 18 days ago
JSON representation
A module that provides basic linked list data structures.
- Host: GitHub
- URL: https://github.com/bytebit-org/roblox-linkedlists
- Owner: Bytebit-Org
- License: mit
- Created: 2022-03-22T19:01:19.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T18:43:03.000Z (about 3 years ago)
- Last Synced: 2025-01-30T05:46:29.338Z (12 months ago)
- Language: TypeScript
- Size: 433 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Linked Lists
Linked Lists is a module that provides basic linked list data structures.
## Installation
### roblox-ts
Simply install to your [roblox-ts](https://roblox-ts.com/) project as follows:
```
npm i @rbxts/linked-lists
```
### Wally
[Wally](https://github.com/UpliftGames/wally/) users can install this package by adding the following line to their `Wally.toml` under `[dependencies]`:
```
LinkedLists = "bytebit/linked-lists@1.0.4"
```
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](https://github.com/Bytebit-Org/roblox-LinkedLists/releases) 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.](https://www.roblox.com/library/9171119495/Linked-Lists-Package)
## Documentation
Documentation can be found [here](https://github.com/Bytebit-Org/roblox-LinkedLists/tree/master/docs), is included in the TypeScript files directly, and was generated using [TypeDoc](https://typedoc.org/).
## Example
Below is a simple example showing the use of a singly-linked list to implement a queue:
roblox-ts example
```ts
import { SinglyLinkedList } from "@rbxts/linked-lists";
export class Queue {
private readonly linkedList = new SinglyLinkedList();
public push(value: defined) {
this.linkedList.pushToTail(value);
}
public pop() {
return this.linkedList.popHeadValue();
}
}
```
Luau example
```lua
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
}
```