Log inGet started

library

Updated October 16, 2026

Discover, check, and import library assets — the @builtin/* tree the engine ships and the @namespace/* trees imported from other worlds.

require("@builtin::modules.api.engine.library") -- library (also available as global 'library')

The library namespace: 9 functions.

globals/library/has

library.has(path: string) -> boolean

Check if a library asset exists at the given path. Answers from the content the engine holds: an imported library's namespace ("@mylib") and its assets answer true once its pinned commit is mounted, and false while only its marker is there.

Parameters

  • path string — Library asset path (e.g. "@builtin/models/Sample/DamagedHelmet").

Returns boolean — True if the asset exists in the library.

assert(library.has("@builtin/models/Cube"))

globals/library/import

library.import(namespace: string, worldRef: string) -> LibraryImport

Import another world as a library under the given namespace. Resolves the world, pins its current commit, and writes the library marker at /source/libs/@<namespace>, then waits while the engine fetches the pinned commit from ZeroMind and mounts it. When it returns, the imported tree answers to require("@<namespace>::path") and is listed by library.list(). A library that does not mount raises naming why, and running the import again retries it.

Parameters

  • namespace string — Library namespace, with or without the leading @ (e.g. "@mylib" or "mylib").
  • worldRef string — The upstream world's guid, or its name as it appears in world.list().

Returns LibraryImport — Record describing the import: the local name, the marker path, the upstream world_guid, and the pinned commit as version.

library.import("@mylib", "my-shared-world")

globals/library/list

library.list(assetType: string?) -> { LibraryAsset }

List all available library assets. Optionally filter by asset type — call asset.categories() for the live set.

Parameters

  • assetType string (optional) — Asset type filter (optional).

Returns { LibraryAsset } — Array of asset descriptors. path is the @builtin::* identity, type is one of the valid type strings, format is the original file extension (e.g. "glb", "luau", "wgsl").

for _, a in ipairs(library.list("model")) do print(a.path) end

modules/library/has

has(path: string): boolean

Check if a library asset exists at the given path. Answers from the content the engine holds: an imported library's namespace ("@mylib") and its assets answer true once its pinned commit is mounted, and false while only its marker is there.

Parameters

  • path string — Library asset path (e.g. "@builtin/models/Sample/DamagedHelmet").
assert(library.has("@builtin/models/Cube"))

modules/library/import

import(namespace: string, worldRef: string): LibraryImport

Import another world as a library under the given namespace. Resolves the world, pins its current commit, and writes the library marker at /source/libs/@<namespace>, then waits while the engine fetches the pinned commit from ZeroMind and mounts it. When it returns, the imported tree answers to require("@<namespace>::path") and is listed by library.list(). A library that does not mount raises naming why, and running the import again retries it.

Parameters

  • namespace string — Library namespace, with or without the leading @ (e.g. "@mylib" or "mylib").
  • worldRef string — The upstream world's guid, or its name as it appears in world.list().
library.import("@mylib", "my-shared-world")

modules/library/list

list(assetType: string?): { LibraryAsset }

List all available library assets. Optionally filter by asset type — call asset.categories() for the live set.

Parameters

  • assetType string? (optional) — Asset type filter (optional).
for _, a in ipairs(library.list("model")) do print(a.path) end

typed/builtin//modules/api/engine/library/library/has

library.has(path: string) -> boolean

Check if a library asset exists at the given path. Answers from the content the engine holds: an imported library's namespace ("@mylib") and its assets answer true once its pinned commit is mounted, and false while only its marker is there.

Parameters

  • path string — Library asset path (e.g. "@builtin/models/Sample/DamagedHelmet").

Returns boolean — True if the asset exists in the library.

assert(library.has("@builtin/models/Cube"))

typed/builtin//modules/api/engine/library/library/import

library.import(namespace: string, worldRef: string) -> LibraryImport

Import another world as a library under the given namespace. Resolves the world, pins its current commit, and writes the library marker at /source/libs/@<namespace>, then waits while the engine fetches the pinned commit from ZeroMind and mounts it. When it returns, the imported tree answers to require("@<namespace>::path") and is listed by library.list(). A library that does not mount raises naming why, and running the import again retries it.

Parameters

  • namespace string — Library namespace, with or without the leading @ (e.g. "@mylib" or "mylib").
  • worldRef string — The upstream world's guid, or its name as it appears in world.list().

Returns LibraryImport — Record describing the import: the local name, the marker path, the upstream world_guid, and the pinned commit as version.

library.import("@mylib", "my-shared-world")

typed/builtin//modules/api/engine/library/library/list

library.list(assetType: string?) -> { LibraryAsset }

List all available library assets. Optionally filter by asset type — call asset.categories() for the live set.

Parameters

  • assetType string (optional) — Asset type filter (optional).

Returns { LibraryAsset } — Array of asset descriptors. path is the @builtin::* identity, type is one of the valid type strings, format is the original file extension (e.g. "glb", "luau", "wgsl").

for _, a in ipairs(library.list("model")) do print(a.path) end
  • api
  • reference