DatumHuePlatform v0.0.24datumhue.com
Contents

namespaceApplication Management13 functions, 1 property

datumhue.app

Spawn child apps, end this app, look up this app, its parent and the root app, and check and request permissions.

Returns handles
App

Fields 1

FieldTypeAccessDescription
offlinebooleanread-onlyTrue while no deployment connection is up.

Functions 13

datumhue.app.spawn

function
datumhue.app.spawn(options: app.SpawnAppOptions) -> App

Spawn a child app from inline code, a loaded package, or a resolved package_ref. Returns the child's App handle immediately. A UI child that no window manager has wrapped (wm.wrap_app) by the time its script starts opens in the window of its nearest ancestor that has one, the root app aside: its parent's (this app's, or that of the parent named), or past service apps, which have none, the UI app's above them; with no such ancestor it opens at the top level. There it sits over that app's ui.root but outside it, so that app's focus navigation and Back never reach its widgets, at x/y/width/height from the window's top-left or filling the window, clipped, moved, resized, minimized and stacked with it. A press in it focuses it, and a press in the window's own area focuses that app again; a Back nothing in it takes goes on to the frame around the window. A window manager that wraps it later lifts it into its frame. Given a host element, it lives in that element instead.

Example
local stage = datumhue.ui.root:panel({ width = 320, height = 200 })
local clock = datumhue.app.spawn({
    name = "clock",
    code = [[datumhue.ui.root:label({ text = "12:00" })]],
    host = stage,
})
clock:on_end(function(e)
    print(e.reason) --> terminated
end)
datumhue.time.after(1, function()
    stage:remove()
end)

options app.SpawnAppOptions options 25 keys

KeyTypeDefaultDescription
namestringa package takes its manifest name, and inline code raisesApp name.
codestringthe package or package_ref sourceInline Lua source. Mutually exclusive with package / package_ref. It compiles as source only, so a compiled chunk ends the child with a compile fault.
packagePackagethe code or package_ref sourceA loaded package bundle to run. Mutually exclusive with code / package_ref. A value that is not a handle is ignored.
package_refPackageRefthe code or package sourceA catalog reference; the child arrives once resolved + downloaded. Mutually exclusive with code / package.
storage"spawner" | "own"inline code uses this app's storage identity, and a package has its ownWhose data a child spawned from inline code uses: this app's, or a set of its own. Raises with package or package_ref.
weightnumber10The child's share of script running time when apps compete for it, relative to the other running apps' weights; must be > 0.
xnumberthe child fills the window it opens inInitial bounds x; set x/y/width/height together.
ynumberthe child fills the window it opens inInitial bounds y; set x/y/width/height together.
widthnumberthe child fills the window it opens inInitial bounds width; set x/y/width/height together.
heightnumberthe child fills the window it opens inInitial bounds height; set x/y/width/height together.
argsstring[]the child gets no argumentsLaunch arguments passed to the child.
titlestringthe app nameWindow title for the child app.
dirstable<string, Dir | app.PreopenEntry>no directory is grantedDirectories to grant, keyed by child-facing name; each value is a Dir handle or a {handle, mode} entry.
filestable<string, File | app.PreopenFileEntry>no file is grantedFiles to grant, keyed by child-facing name; each value is a File handle or a {handle, mode} entry.
data_mountstable<string, DataMount>no data mount is grantedData mounts to grant, keyed by child-facing name.
http_mountstable<string, HttpMount>no HTTP mount is grantedHTTP mounts to grant, keyed by child-facing name. A child can only receive mounts the parent holds.
ingress_mountstable<string, IngressMount>no ingress mount is grantedIngress mounts to grant, keyed by child-facing name. A child can only receive mounts the parent holds.
permissionsapp.SpawnPermissionsno capability is grantedCapabilities to grant the child; narrowed against the parent's grants.
servicebooleaninline code runs as a UI app, and a package as its manifest saysSpawn headless; valid only with inline code.
chunk_namestringpkg:@local/<name>/init.lua, from nameThe name Lua gives the child's code wherever it shows a position: compile and runtime errors, error positions, the messages pcall returns, tracebacks and the child's fault. Used exactly as given: 1 to 59 bytes of UTF-8 with no control characters. It changes nothing else, not the app's name, title or data. Valid only with inline code.
max_stepsintegerno limit of the child's own: it takes the limit this app runs under, if any, and otherwise runs each job as long as it needs, a slice at a timeThe most steps one stretch of the child's code may run without pausing. A stretch starts as its script, a callback, a timer or on_update starts, and ends when that returns, waits on a suspending call such as time.wait_frames, or yields. A step is about one Lua instruction, and a library or datumhue call a few; the same code counts the same steps on every device. The count is checked about every 4096 steps, so a stretch may run up to that many past the limit. Going over ends the child as crashed, with a steps fault, and pcall cannot catch it. datumhue.on_terminate and the finalizers run as the child ends are not counted. A child of a limited app runs under the lower of the two limits.
parentAppthe callerThe app to place the child under: the caller or one of its ancestors.
hostUiElementthe child opens in its nearest windowed ancestor's window, at x/y/width/height or filling itAn element of this app for a UI child of this app to live in. Its window fills the element's box inside any border and follows it as it moves, resizes, hides and shows; it is clipped by the element's ancestors, scrolls with an enclosing scroll container, and draws above the element's own children and under this app's popovers. A press in it focuses it; Tab and the arrow keys enter it at the element's place in this app's order and leave it past its first or last widget; a cancel request it leaves goes on to this app from the element. Window managers cannot wrap, move, resize or minimize it. Removing the element, or an element holding it, ends the child as terminated. Raises with x, y, width or height, with service = true or a service package, with a parent other than this app, and for an element that was removed, is another app's, is a window manager's frame or already holds an app that has not ended. A service app named by package_ref is known only once it arrives: it never starts, and ends as not_started.
on_printfun(e: app.PrintEvent)no defaultCalled with the lines the child prints, at most once a frame; valid only with inline code. The lines still go to the workstation's log. The callback keeps this app running until the child has ended and its last lines have arrived.
on_messagefun(e: app.MessageEvent)no defaultCalled with the messages the child posts with app.post_message, at most once a frame, with every message since the last call; valid only with inline code. Each call for the child runs before this app's App:on_end callback for it. The callback keeps this app running until the child has ended and its last messages have arrived.

datumhue.app.post_message

function
datumhue.app.post_message(payload: any)

Send a copy of payload to the on_message callback the app that spawned this one gave, which gets it on a later frame with every message sent since its last call. Booleans, integers and floats, which stay apart, strings, byte for byte, and tables of these are copied; a table payload holds twice arrives as two tables. Once that app has ended, the message is dropped. Raises when that app gave no on_message, for a nil payload or one holding a function, coroutine or handle, for a table inside itself, tables nested more than 127 deep or a copy larger than 64 KiB, and while 1000 messages or 1 MiB of them wait for that app.

Example
-- Runs in a child spawned with `on_message`, which gets two copies; the
-- first still holds 3 stars.
local score = { lesson = "1.3", stars = 3, ratio = 0.75 }
datumhue.app.post_message(score)
score.stars = 4
datumhue.app.post_message(score)

datumhue.app.terminate

function
datumhue.app.terminate()

Terminate this app. Cascades to all descendants.

datumhue.app.self

function
datumhue.app.self() -> App

This app's own opaque App handle.

datumhue.app.parent

function
datumhue.app.parent() -> App?

This app's parent App handle, or nil for the root app.

datumhue.app.bootstrap

function
datumhue.app.bootstrap() -> App?

The root app's App handle. Returns this app's own handle when called from the root.

datumhue.app.is_focused

function
datumhue.app.is_focused() -> boolean

Whether this app currently has focus. Always false for service apps.

datumhue.app.is_service

function
datumhue.app.is_service() -> boolean

Whether this app was spawned as a service. Fixed at spawn time and immutable.

datumhue.app.has_permission

function
datumhue.app.has_permission(name: app.Permission) -> boolean

Whether this app currently holds the named capability. An unknown name raises.

datumhue.app.request_permission

functionsuspends
datumhue.app.request_permission(name: app.Permission, opts?: app.RequestPermissionOptions) -> boolean

Request a capability from the parent window manager. Returns true immediately if already held, otherwise the parent's verdict — the parent may prompt the user before answering. An unknown name raises.

Example
local granted = datumhue.app.request_permission("screenshot", {
    reason = "Attach a picture of your board to the bug report.",
})
if granted then
    local board = datumhue.screen.screenshot()
    print(board.width, board.height)
end

opts app.RequestPermissionOptions options 1 key

KeyTypeDefaultDescription
reasonstringthe request carries no justificationJustification shown to the user when the window manager prompts for approval.

datumhue.app.permission_summary

function
datumhue.app.permission_summary(permission: app.Permission) -> string

One plain sentence, in the current locale, saying what a permission lets an app do. For permission prompts and lists of what an app may do.

datumhue.app.session

function
datumhue.app.session() -> string

The identifier of the session the workstation was started as: the session name given at launch, or a default when none was. Every app gets the same value.

datumhue.app.errors

function
datumhue.app.errors() -> string[]

What went wrong while the workstation started, in its launch options or loading its first app, as a 1-based string array (empty if none). Only the root app sees the list; any other app gets an empty table.

Types 13

app.EndEvent

record

record 3 keys

KeyTypeDescription
reason"exited" | "terminated" | "crashed" | "not_started"How the app ended.
message?stringWhy the app never started, as one sentence for users in the current locale; nil for an app that started.
fault?app.FaultFor a crashed app spawned from inline code: what ended it. Nil for any other end, and for an app spawned from a package, whose error is in the workstation's log alone.

Used by: App:on_end

app.Fault

record

record 5 keys

KeyTypeDescription
kind"compile" | "runtime" | "memory" | "steps"What ended the app.
messagestringWhat ended the app, in words, as its kind says. At most 16 KiB: a longer one is cut and ends in ....
line?integerThe line of the app's own code it ended on: the line a compile error names, else the line of the position its message started with, else the line of the innermost frame in the app's own code. Nil when none applies.
framesapp.FaultFrame[]The Lua frames of the calls that led there, innermost first, without the levels of library functions. Of a longer chain it keeps the 10 innermost and the 11 outermost.
skippedintegerHow many levels of the chain were left out. They sit between frames[10] and frames[11].

Nested in: app.EndEvent, events.AppTerminated

app.FaultArg

record

record 2 keys

KeyTypeDescription
namestringThe parameter's name, or ... for an extra argument of a vararg function.
valuestringThe value as Lua displays it, cut at 80 bytes and then ending in ... when longer.

Nested in: app.FaultFrame

app.FaultFrame

record

record 5 keys

KeyTypeDescription
chunkstringThe chunk the frame runs in: the chunk name of the app's own code, or of other code it runs, such as a chunk load compiled.
lineintegerThe line the frame runs, or the line of the call it makes.
name?stringThe name its function was defined with. Nil for the main chunk and an anonymous function.
defined?integerThe line its function was defined on. Nil for the main chunk.
argsapp.FaultArg[]Its arguments: the parameters, then the extra arguments of a vararg function, at most 16.

Nested in: app.Fault

app.FaultKind

enum
ValueDescription
"compile"Its entry script failed to compile. message is Lua's message, line the line it names, and frames is empty.
"runtime"An error escaped its code. message is the error value as Lua displays it, without the chunk:line: it starts with when that chunk is the app's own code. A value that is neither a string nor a number reads (error object is a <type> value).
"memory"It used more memory than an app may, or an allocation it asked for failed. message is a sentence saying so.
"steps"A stretch of its code ran more steps without pausing than its limit allows. message is a sentence saying so.

Nested in: app.Fault

app.MessageEvent

record

record 1 key

KeyTypeDescription
messagesany[]The messages posted since the last callback, in the order they were posted, each a copy of the value given to app.post_message. The first message is at index 1.

Nested in: app.SpawnAppOptions

app.Permission

enum
ValueDescription
"identity"Unlocks the signed-in identity's claims (datumhue.identity).
"screenshot"Unlocks screen capture (screen.screenshot).
"network"Unlocks network-scoped messaging and documents (scope = "network").
"commerce"Unlocks paid-package purchasing and entitlements (datumhue.commerce).
"packages"Unlocks install management: installing, uninstalling, and reading the installed-package library.
"devices"Unlocks listing and removing the devices that use the signed-in account's purchases (commerce.devices).

Used by: datumhue.app.has_permission, datumhue.app.request_permission, datumhue.app.permission_summary, PermissionRequest.permission

Nested in: events.AppPermissionRequest

app.PreopenEntry

options

options 2 keys

KeyTypeDefaultDescription
handle requiredDirno defaultThe handle to inherit.
mode"r" | "rw"the parent's access modeMode narrowing the inherited access.

Nested in: app.SpawnAppOptions

app.PreopenFileEntry

options

options 2 keys

KeyTypeDefaultDescription
handle requiredFileno defaultThe handle to inherit.
mode"r" | "rw"the parent's access modeMode narrowing the inherited access.

Nested in: app.SpawnAppOptions

app.PreopenMode

enum
ValueDescription
"r"
"rw"

Used by: Dir:mode, File:mode

Nested in: app.PreopenEntry, app.PreopenFileEntry

app.PrintEvent

record

record 2 keys

KeyTypeDescription
linesstring[]The lines printed since the last callback, in order, one per print call: its values joined by tabs, with no newline. The first line is at index 1.
droppedintegerHow many lines were left out since the last callback, because the child printed more than one callback carries: at most 1000 lines and 64 KiB of them.

Nested in: app.SpawnAppOptions

app.SpawnPermissions

options

options 6 keys

KeyTypeDefaultDescription
identitybooleanfalseRequest the identity capability.
screenshotbooleanfalseRequest the screenshot capability.
networkbooleanfalseRequest the network capability.
commercebooleanfalseRequest the commerce capability (purchase paid packages).
packagesbooleanfalseRequest the packages capability (manage the installed-package library).
devicesbooleanfalseRequest the devices capability (list and remove the devices that use the account's purchases).

Nested in: app.SpawnAppOptions

app.SpawnStorage

enum
ValueDescription
"spawner"The child opens this app's stores, named documents, network topics and presence groups.
"own"The child gets stores, named documents, network topics and presence groups of its own, apart from this app's. Every child this app spawns this way shares that one set, which lasts between runs, and so do the children those spawn from inline code.

Nested in: app.SpawnAppOptions

datumhue.com

(c) 2026 Shuusei AB. Quote excerpts of this manual, with attribution to DatumHue, in your own documentation, tutorials, course materials, reviews, and other writing or video. Republishing it in whole or in substantial part needs written permission: support@datumhue.com.

Victor Mono is licensed under the SIL Open Font License 1.1
Copyright (c) 2024, Rune Bjørnerås (https://github.com/rubjo)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Try

    ↑↓ selectEnter openTab filter

    Settings

    Theme
    Text
    Print

    Keyboard shortcuts

    / or Ctrl KSearch
    ↑ ↓ EnterPick a result
    TabNext result filter
    j kNext or previous entry
    [ ]Previous or next page
    yCopy a link to the current entry
    ?These shortcuts
    EscClose

    On this page