AcediaDocumentation

getmenv

Returns the environment of a loaded ModuleScript.

Does not require the module for you.

getmenv(target: ModuleScript): table

Parameters

ParameterTypeDescription
targetModuleScriptModule that has already been required.

Example

local target = game:FindFirstChildWhichIsA("ModuleScript", true)
if target then
    local ok, env = pcall(getmenv, target)
    print(ok, type(env))
end

Example output

true	table

Errors: Raises if the module has not been required or its environment cannot be reached.

On this page