nupp
nupp is an always available global table that declares the Nupp standard library. It's available without a require.
-- You can use nupp and nested modules without any `require` statements.
local text = nupp.codec.json.encode({ok = true})
nupp.log.info("wrote %d bytes", #text)nupp and nested submodules within it are available using sub-property access without the need to require anything. Submodules are loaded lazily on first access.
See Standard library for what belongs here and what does not, and Modules for how a declared module is reached.
Submodules
| Module | Description |
|---|---|
nupp.bitset | |
nupp.browser | 1 module |
nupp.checksum | Incremental numeric checksums for accidental corruption detection. |
nupp.codec | 4 modules |
nupp.crypto | Cryptographically secure randomness from the provider retained at module load. |
nupp.derive | Generates checked members on a declaration while that declaration is checked. |
nupp.digest | Provider-selected fixed-output message digests. |
nupp.events | Addressed, synchronous events whose payloads are ordinary declarations. |
nupp.gpu | Resident compute buffers over the selected GPU provider. |
nupp.hash | General-purpose noncryptographic hashing. |
nupp.hotreload | Cooperative development hot reload, installed by nupp run --watch. |
nupp.io | nupp.io is bytes: storage for them, and the readers and writers that move them. |
nupp.log | nupp.log is leveled logging whose disabled path is the one it is designed around. |
nupp.mac | Keyed message authentication. |
nupp.math | nupp.math adds the scalar, fixed-width and two-dimensional operations missing from Lua's built-in math table. |
nupp.mem | C storage and the checked views over it. |
nupp.peg | nupp.peg compiles textual parsing-expression grammars into reusable typed matchers. |
nupp.profile | Two profiling channels: one for where the time went, one for whether it went there compiled. |
nupp.random | Deterministic pseudo-random generation with explicit, serializable state. |
nupp.reflect | Semantic type reflection and reflection-driven field codecs. |
nupp.runtime | 5 modules |
nupp.serde | nupp.serde separates logical data from its physical representation. |
nupp.services | Typed service definitions and named implementations within one Lua state. |
nupp.simd | |
nupp.store | Typed keys and the stores they index. |
nupp.suspension | |
nupp.system | Facts about the environment executing the Nupp ABI. |
nupp.tasks | An application task scope. |
nupp.test | Assertions shared by Nupp's bundled test runner and project test suites. |
nupp.text | 2 modules |
nupp.time | |
nupp.types | Compiler-only type inspection and construction inside comptime function declarations. |
nupp.uuid | UUID generation using the implementation retained when this module loads. |
nupp.workers |
Module contents
Types
| Type | Kind | Description |
|---|---|---|
AliasError | record | A failed operation on a managed alias. |
Closeable | interface | A resource with a deterministic, consuming close operation. |
Debug | interface | Values with deterministic compiler-generated debug formatting. |
ManagedGroup | interface | A runtime-sized heterogeneous owner group. |
Types#
AliasErrorrecord#
record nupp.AliasError
code: string
message: string
endA failed operation on a managed alias.
Fields
code#
code: stringmessage#
message: stringCloseableinterface#
A resource with a deterministic, consuming close operation.
Declaring is nupp.Closeable makes construction and bare type annotations carry the close obligation automatically. A resource that publishes pending work declares flush on its own contract; closing is the lifecycle common to all resources.
Methods
Debuginterface#
Values with deterministic compiler-generated debug formatting.
Methods
ManagedGroupinterface#
interface nupp.ManagedGroup is nupp.Closeable
flush: function(exclusive self: nupp.ManagedGroup): nil
adopt: function<T>(exclusive self: nupp.ManagedGroup, takes cell: managed(T)): alias(T)
remove: function<T>(exclusive self: nupp.ManagedGroup, handle: alias(T)): T
endA runtime-sized heterogeneous owner group.
managedGroup adopts independently managed cells and closes every remaining resource in reverse adoption order. It is ordinary library code over aliases; the compiler does not give the group special ownership privileges.
Methods
flush#
flush: function(exclusive self: nupp.ManagedGroup): nilCells publish no pending data of their own. Their payloads decide what close publishes.
Arguments
| Name | Type | Description |
|---|---|---|
exclusive self | nupp.ManagedGroup |
Returns
| Type | Description |
|---|---|
nil |
adopt#
adopt: function<T>(exclusive self: nupp.ManagedGroup, takes cell: managed(T)): alias(T)Moves a managed cell into the group and returns its checked non-owning alias.
Arguments
| Name | Type | Description |
|---|---|---|
exclusive self | nupp.ManagedGroup | |
takes cell | managed(T) |
Returns
| Type | Description |
|---|---|
alias(T) |
remove#
remove: function<T>(exclusive self: nupp.ManagedGroup, handle: alias(T)): TRemoves an adopted alias and restores its exact original owner.
Arguments
| Name | Type | Description |
|---|---|---|
exclusive self | nupp.ManagedGroup | |
handle | alias(T) |
Returns
| Type | Description |
|---|---|
T |