---
title: "library"
description: "The library namespace — the engine's Luau API reference for library."
section: "API Reference"
slug: "api-library"
canonical: "https://origozero.ai/docs/api-library"
updated: "2026-09-06T05:08:07.386883130+00:00"
tags: ["api", "reference"]
---

# library

The `library` namespace — 10 functions.

## globals/library/has {#globals-library-has}

```lua
library.has(path: string) -> boolean
```

Check if a library asset exists at the given path.

**Parameters**

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

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

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

## globals/library/import {#globals-library-import}

```lua
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>`. Once the engine has
fetched the pinned commit, the imported tree answers to
`require("@<namespace>::path")`, is listed by `library.list()`, and
is readable under `/zero/source/libs/@<namespace>/`.

**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`.

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

## globals/library/list {#globals-library-list}

```lua
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"`).

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

## modules/library/README {#modules-library-readme}

```lua
require("@builtin/modules/api/engine/library") -- library (also available as global 'library')
```

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

Usage: local library = require("@builtin/modules/api/engine/library")
Also available as global: library

## modules/library/has {#modules-library-has}

```lua
has(path: string): boolean
```

Check if a library asset exists at the given path.

**Parameters**

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

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

## modules/library/import {#modules-library-import}

```lua
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>`. Once the engine has
fetched the pinned commit, the imported tree answers to
`require("@<namespace>::path")`, is listed by `library.list()`, and
is readable under `/zero/source/libs/@<namespace>/`.

**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()`.

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

## modules/library/list {#modules-library-list}

```lua
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).

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

## typed/builtin//modules/api/engine/library/library/has {#typed-builtin-modules-api-engine-library-library-has}

```lua
library.has(path: string) -> boolean
```

Check if a library asset exists at the given path.

**Parameters**

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

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

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

## typed/builtin//modules/api/engine/library/library/import {#typed-builtin-modules-api-engine-library-library-import}

```lua
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>`. Once the engine has
fetched the pinned commit, the imported tree answers to
`require("@<namespace>::path")`, is listed by `library.list()`, and
is readable under `/zero/source/libs/@<namespace>/`.

**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`.

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

## typed/builtin//modules/api/engine/library/library/list {#typed-builtin-modules-api-engine-library-library-list}

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

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