Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

library Module

The library surface — discover, check, and import library assets.

Purpose

Expose the library surface as a typed Luau table that gets auto-injected as _G.library via the prelude. list and has read the raw __library.* FFI namespace; import binds another world under a namespace. Library assets live under @builtin/* (engine-shipped) and imported @namespace/* trees (worlds-as-libraries via library.import).

Usage

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

-- Check existence
if library.has("@builtin/models/Cube") then ... end

-- Import another world as a library namespace, by name or by guid
local imported = library.import("@mylib", "my-shared-world")
print(imported.world_guid, imported.version)
-- It returns once the pinned commit is mounted: require("@mylib::path")
-- resolves and library.list() lists the tree

library.import resolves the world reference (guid, or a name from world.list()), pins its current commit, and writes the library marker at /source/libs/@<namespace> — the same declarative dependency world.installLibrary records — then waits while the engine fetches that commit from ZeroMind and mounts it. A library that does not mount raises naming why, and running the import again retries it. world.uninstallLibrary removes the marker.

Exports

  • library.list(assetType?) -> { LibraryAsset }
  • library.has(path) -> boolean
  • library.import(namespace, worldRef) -> LibraryImport