A Universally Unique Lexicographically Sortable Identifier generator for Luau.
Simply copy and paste the contents of lib/init.luau into your project.
This project should work in the following runtimes:-
| Runtime | Supported | Has detectable CSPRNG | Has detectable ms-precise time function |
|---|---|---|---|
| Roblox | ✅ | ❌ | ✅ |
| Lune | ✅ | ❌ | ✅ |
| Zune | ✅ | ✅ | ✅ |
| Pure Luau | ✅ | ❌ | ❌ |
local ulid = require("./ulid").generator();
print(ulid()); --> 01BX5ZZKBKACTAV9WEVGEMMVS0A list of generator options is as follows:-
| Option | Type | Default | Description |
|---|---|---|---|
| monotonic | boolean |
false |
Whether to use a monotonic generator |
| dependencies | { prng: (min: number, max: number) -> number, time: () -> number } |
Runtime Dependent | Dictionary of functions to provide dependent functions |
| allow_insecure | boolean |
false |
Whether to suppress insecure errors |
| allow_imprecise | boolean |
false |
Whether to suppress imprecise errors |
Partially based on the ULID reference implementation.
Please feel free to submit pull requests, preferably stick to the same code style.