Environment

getrenv

Returns the Roblox environment table.

Syntax

getrenv(): table

Returns

NameTypeDescription
environmenttableEnvironment table for the selected context.

Description

Returns the Roblox environment table.

Call it without parameters. The function reads the needed context from the current runtime state.

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 = getrenv()
print(result)