search/
Start typing to search packages!
package_2
vault
By @paramacode
Roblox
MirroredVAULT
Vault is a high-performance, type-safe resource management library for Roblox Luau. It provides automatic cleanup of connections, instances, promises, threads, and custom objects with intelligent method detection, hierarchical organization, and zero memory leaks.
FEATURES
High Performance
--!optimize 2 --!strictcompiler flags for maximum runtime efficiencyrawget()direct lookups bypass table prototype chains for method detection- Global
CLEANUP_CACHEstores cleanup functions bytypeof()- no recreation overhead - Sequential numeric tokens enable O(1)
Add()/Remove()operations - Weak metatable (
__mode = 'k') for automatic internal state cleanup - O(1) critical path:
Add,Remove,Size,Containsoperations
Type Safe
- 15+
CleanableObjectunion types: Instance, RBXScriptConnection, Promise, thread, functions - Generic signal support:
<T...>for RBXScriptSignal + CustomSignal - Constructor generics:
<T, A...>with perfect type inference - Metatable method detection with full
__indexsupport
Hierarchical Management
MainVault
├── Child1 (Extend)
│ └── DeferredScope (Defer)
├── Child2 (Extend)
└── ImportedVault (Import)
- Automatic cascade cleanup -
Clean()recursively cleans all children - Parent-child unlink - children automatically removed from parent array
- Scoped inheritance - children inherit parent's cleanup lifecycle
Intelligent Detection
Detection Priority (fast → slow):
1. Custom CleanupStrategy (function or method string)
2. typeof() cached cleanup (Instance→Destroy(), RBXScriptConnection→Disconnect())
3. Promise status validation (getStatus() + cancel if 'Started')
4. Direct methods: Destroy/destroy, Disconnect/disconnect
5. Metatable.__index: Destroy/destroy, Disconnect/disconnect
API COMPLEXITY
| Operation | Complexity | Description |
|---|---|---|
Add() | O(1) | Token assignment + hash insert |
Remove() | O(1) | Token/object lookup + hash remove |
Clean() | O(n) | Required for deterministic cleanup |
Connect() | O(1) | Signal connection + auto-add |
Size() | O(1) | Cached entry counter |
Vault guarantees zero memory leaks with deterministic cleanup across all Roblox resource types while maintaining industry-leading performance.
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
