Must is just a simple function that errors out if the argument is nil / undefined.
Simply install to your roblox-ts project as follows:
npm i @rbxts/must
Wally users can install this package by adding the following line to their Wally.toml
under [dependencies]
:
Must = "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.
Here's a simple example of a function that just wants to throw if the value it looks up is nil
/ undefined
.
roblox-ts example
import { must } from "@rbxts/must";
export class Foo {
public bar() {
const fetchedValue = must(fetchSomeValue());
// more logic
}
}
Luau example
local must = require(path.to.modules["must"]).must
local Foo = {}
Foo.__index = Foo
function new()
local self = {}
setmetatable(self, Foo)
return self
end
function Foo:bar()
local fetchedValue = must(fetchSomeValue())
-- more logic
end
return {
new = new
}