Reverse Array is a simple function that just reverses any array given to it.
Simply install to your roblox-ts project as follows:
npm i @rbxts/reverse-array
Wally users can install this package by adding the following line to their Wally.toml
under [dependencies]
:
ReverseArray = "bytebit/[email protected]"
Then just run wally install
.
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.
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 can be found here, is included in the TypeScript files directly, and was generated using TypeDoc.
In this example, an array is created, each value printed, a reversed array created, and then each of its values are printed
roblox-ts example
import { reverseArray } from "@rbxts/reverse-array";
const forwardArray = [1, 2, 3, 4];
for (const value of forwardArray) {
print(value)
}
const backwardArray = reverseArray(forwardArray);
for (const value of backwardArray) {
print(value)
}
Luau example
local reverseArray = require(path.to.modules["reverse-array"]).reverseArray
local forwardArray = [1, 2, 3, 4]
for _, value in ipairs(forwardArray)
print(value)
end
local backwardArray = reverseArray(forwardArray)
for _, value in ipairs(backwardArray)
print(value)
end