getgenv

Accesses the executor global environment.

Syntax

Signature
getgenv() -> table

Aliases

This function has no aliases.

Parameters

This function takes no parameters.

Returns

TypeDescription
tableLive executor global environment.

Notes

Returns the executor thread's global environment when that thread belongs to the current VM. Otherwise returns the calling thread's global environment. The returned table is shared by scripts using that environment.

Example

Luau
getgenv().ExampleValue = 42
print(getgenv().ExampleValue)