getscriptglobals Synchronous

Collect the runtime's _G and shared tables in one record. It is convenient when checking state another Roblox script has placed in those tables.

Syntax
Luau
getscriptglobals() -> {_G: Table, shared: Table}

Parameters

This function takes no arguments.

Returns

{_G: Table, shared: Table}

A table with _G and shared fields, each referring to a runtime global table.

Usage notes

These fields reference live tables; this call does not clone their contents.

Example

Example
Luau
local globals = getscriptglobals()
print("_G is a table:", type(globals._G) == "table")
print("shared is a table:", type(globals.shared) == "table")
Kawaii documentation