Log inGet started

layers

The layers namespace — the engine's Luau API reference for layers.

The layers namespace — 18 functions.

globals/layers/active

globals/layers/active() -> any

globals/layers/find

globals/layers/find(ref: AssetRef<scene> | string) -> any?

globals/layers/fireBeforeLoad

globals/layers/fireBeforeLoad(proxy: any) -> nil

globals/layers/fireLoad

globals/layers/fireLoad(proxy: any) -> nil

globals/layers/fireUnload

globals/layers/fireUnload(proxy: any) -> nil

globals/layers/install

globals/layers/install() -> nil

globals/layers/is_loaded

globals/layers/is_loaded(ref: AssetRef<scene> | string) -> boolean

globals/layers/list

globals/layers/list() -> { any }

globals/layers/load

globals/layers/load(ref: AssetRef<scene> | string, opts: LoadOpts?) -> any

Load a scene into the root non-additive slot ("main") OR as an additive overlay alongside it. Identity is ref-based: pass an AssetRef<scene> envelope (preferred — caught at the callsite by the LSP) or an identity string (resolved via asset.ref at entry, hard-error if no stable guid comes back). For non-additive, idempotency is by guid: re-loading the same scene logs and returns the existing proxy without tearing anything down. Different guid → unloads the current root + cascades every additive overlay it spawned + transitions the multiplayer room + loads the new scene. Logs every step at info level so a silent no-op is impossible.

globals/layers/loadInFlight

globals/layers/loadInFlight() -> number

Returns the number of scene loads currently in flight (queued but not yet visible via onLoad dispatch). Returns 0 when the engine is in a stable load state. Used by engine.mode = ... to block flips while a load is mid-air; agents can read this to wait for a load to finish before driving the next operation.

globals/layers/offBeforeLoad

globals/layers/offBeforeLoad(h: number) -> boolean

globals/layers/offLoad

globals/layers/offLoad(h: number) -> boolean

globals/layers/offUnload

globals/layers/offUnload(h: number) -> boolean

globals/layers/onBeforeLoad

globals/layers/onBeforeLoad(cb: (any) -> ()) -> number

globals/layers/onLoad

globals/layers/onLoad(cb: (any) -> ()) -> number

globals/layers/onUnload

globals/layers/onUnload(cb: (any) -> ()) -> number

globals/layers/reload

globals/layers/reload(ref: (AssetRef<scene> | string)?) -> any?

globals/layers/unload

globals/layers/unload(refOrProxy: (AssetRef<scene> | string | any)?) -> nil
  • api
  • reference