Scripts

getmenv

Returns the module environment for a ModuleScript.

Syntax

getmenv(script: userdata): table

Arguments

NameTypeDescription
scriptuserdataScript or ModuleScript instance to inspect.

Returns

NameTypeDescription
environmenttableEnvironment table for the selected context.

Description

Returns the module environment for a ModuleScript.

Call it with 1 parameter(s): script. The argument table explains which values are required and which ones only refine the behavior.

It returns environment (table). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = getmenv(game)
print(result)