Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bytebit-org/roblox-must
A simple function that just errors out if the value it is given is nil / undefined.
https://github.com/bytebit-org/roblox-must
game-development lua luau npm-package roblox roblox-ts
Last synced: 6 days ago
JSON representation
A simple function that just errors out if the value it is given is nil / undefined.
- Host: GitHub
- URL: https://github.com/bytebit-org/roblox-must
- Owner: Bytebit-Org
- License: mit
- Created: 2022-03-21T19:36:10.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-05T05:19:07.000Z (over 2 years ago)
- Last Synced: 2024-06-27T11:41:06.231Z (5 months ago)
- Topics: game-development, lua, luau, npm-package, roblox, roblox-ts
- Language: Python
- Homepage:
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Must
Must is just a simple function that errors out if the argument is nil / undefined.
## Installation
### roblox-ts
Simply install to your [roblox-ts](https://roblox-ts.com/) project as follows:
```
npm i @rbxts/must
```### Wally
[Wally](https://github.com/UpliftGames/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`.
### 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-Must/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/9164403107/Warn-Function)## Documentation
Documentation can be found [here](https://github.com/Bytebit-Org/roblox-Must/tree/master/docs), is included in the TypeScript files directly, and was generated using [TypeDoc](https://typedoc.org/).## Example
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
```ts
import { must } from "@rbxts/must";export class Foo {
public bar() {
const fetchedValue = must(fetchSomeValue());
// more logic
}
}
```Luau example
```lua
local must = require(path.to.modules["must"]).mustlocal Foo = {}
Foo.__index = Foofunction new()
local self = {}
setmetatable(self, Foo)return self
endfunction Foo:bar()
local fetchedValue = must(fetchSomeValue())-- more logic
endreturn {
new = new
}
```