Log inGet started

scopes

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

The scopes namespace — 3 functions.

globals/scopes/current

scopes.current() -> string?

The scope the calling code registers a resource under right now — the module whose body is running, the component instance whose lifecycle hook is on the stack, or the chunk of this call. Nil when the caller registers under no context.

Returns string? — The scope tag, or nil.

print("resources I register follow", scopes.current())

globals/scopes/list

scopes.list() -> { LiveResource }

Every live resource that follows an owning context, across every subsystem holding them. A resource registered with no context above it — the engine's own — is not listed, because no scope reaches it.

Returns { LiveResource } — Array of live resources.

for _, r in scopes.list() do print(r.scope, r.kind, r.detail) end

globals/scopes/release

scopes.release(scope: string) -> { Released }

End every resource registered under scope, across every subsystem. Reaches contexts no seam does — the chunk of an execute call that registered something and ended without releasing it.

Parameters

  • scope string — A scope tag, as the scope field of a list() row carries it.

Returns { Released } — One row per subsystem that ended something, with how many it ended.

local ended = scopes.release("exec:__exec_12")
  • api
  • reference