getrenv
Returns a cached view of the Roblox global environment, including _G and shared.
Syntax
getrenv() -> table
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
table | A cached view of the Roblox global environment, including _G and shared |
Description
getrenv is part of the Environment library. Environment helpers return or inspect the global, game and script environments used by the executor and the client.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
Example
local env = getrenv()
print(env._G, env.shared)
Notes
- Mutating a returned environment affects every script that shares it.