gettenv
Returns a function environment table.
Syntax
gettenv(fn: function) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | function | The function or callback to use. |
Returns
| Type | Description |
|---|---|
table | A function environment table |
Description
gettenv 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 function f() end
print(gettenv(f))
Notes
- Mutating a returned environment affects every script that shares it.