getmenv
Returns a ModuleScript environment. This always returns a table; an empty table is used when no environment is resolved.
Syntax
getmenv(script: Instance) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
script | Instance | The script value used by the call. |
Returns
| Type | Description |
|---|---|
table | A ModuleScript environment |
Description
getmenv 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 module = getloadedmodules()[1]
print(getmenv(module))
Notes
- Mutating a returned environment affects every script that shares it.