Skip to content

API global

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 3 revisions

global

Compiler-provided global execution object for the current script domain.

Script API Reference

Overview

global is the global object the compiler provides for the current script domain. Host-injected variables and functions can be read through it, and it exposes the loaded-module registry.

A script can normally read an unshadowed host global by name directly. Reach for global when explicit object access is useful, for example when a local variable shadows the name you need.

Properties

global.modules

Returns

object — the registry of modules loaded in the current script domain.

Note

The registry is intended for diagnostics and advanced host integration. Its internal layout is not a stable application data structure, so do not build application logic on its shape.

Example

@module(MAIN);

export func moduleRegistry() {
    return global.modules;
}

Clone this wiki locally