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

ModuleDescription
nupp.bitset
nupp.browser1 module
nupp.checksumIncremental numeric checksums for accidental corruption detection.
nupp.codec4 modules
nupp.cryptoCryptographically secure randomness from the provider retained at module load.
nupp.deriveGenerates checked members on a declaration while that declaration is checked.
nupp.digestProvider-selected fixed-output message digests.
nupp.eventsAddressed, synchronous events whose payloads are ordinary declarations.
nupp.gpuResident compute buffers over the selected GPU provider.
nupp.hashGeneral-purpose noncryptographic hashing.
nupp.hotreloadCooperative development hot reload, installed by nupp run --watch.
nupp.ionupp.io is bytes: storage for them, and the readers and writers that move them.
nupp.lognupp.log is leveled logging whose disabled path is the one it is designed around.
nupp.macKeyed message authentication.
nupp.mathnupp.math adds the scalar, fixed-width and two-dimensional operations missing from Lua's built-in math table.
nupp.memC storage and the checked views over it.
nupp.pegnupp.peg compiles textual parsing-expression grammars into reusable typed matchers.
nupp.profileTwo profiling channels: one for where the time went, one for whether it went there compiled.
nupp.randomDeterministic pseudo-random generation with explicit, serializable state.
nupp.reflectSemantic type reflection and reflection-driven field codecs.
nupp.runtime5 modules
nupp.serdenupp.serde separates logical data from its physical representation.
nupp.servicesTyped service definitions and named implementations within one Lua state.
nupp.simd
nupp.storeTyped keys and the stores they index.
nupp.suspension
nupp.systemFacts about the environment executing the Nupp ABI.
nupp.tasksAn application task scope.
nupp.testAssertions shared by Nupp's bundled test runner and project test suites.
nupp.text2 modules
nupp.time
nupp.typesCompiler-only type inspection and construction inside comptime function declarations.
nupp.uuidUUID generation using the implementation retained when this module loads.
nupp.workers

Module contents

Types

TypeKindDescription
AliasErrorrecordA failed operation on a managed alias.
CloseableinterfaceA resource with a deterministic, consuming close operation.
DebuginterfaceValues with deterministic compiler-generated debug formatting.
ManagedGroupinterfaceA runtime-sized heterogeneous owner group.

Types#

AliasErrorrecord#

record nupp.AliasError
    code: string
    message: string
end

A failed operation on a managed alias.

Fields

code#
code: string
message#
message: string

Closeableinterface#

affine interface nupp.Closeable
    terminal close: nosuspend function(takes self: nupp.Closeable): nil
end

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

close#
close: nosuspend function(takes self: nupp.Closeable): nil
Arguments
NameTypeDescription
takes selfnupp.Closeable
Returns
TypeDescription
nil

Debuginterface#

interface nupp.Debug
    debug: function(self): string
end

Values with deterministic compiler-generated debug formatting.

Methods

debug#
debug: function(self): string
Arguments
NameTypeDescription
?self
Returns
TypeDescription
string

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
end

A 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): nil

Cells publish no pending data of their own. Their payloads decide what close publishes.

Arguments
NameTypeDescription
exclusive selfnupp.ManagedGroup
Returns
TypeDescription
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
NameTypeDescription
exclusive selfnupp.ManagedGroup
takes cellmanaged(T)
Returns
TypeDescription
alias(T)
remove#
remove: function<T>(exclusive self: nupp.ManagedGroup, handle: alias(T)): T

Removes an adopted alias and restores its exact original owner.

Arguments
NameTypeDescription
exclusive selfnupp.ManagedGroup
handlealias(T)
Returns
TypeDescription
T