Volt

getrenv

Returns the game's global environment table.

Syntax

getrenv() -> table

Returns

TypeDescription
tableThe game's global environment

Description

getrenv returns the global environment used by game scripts. This contains all standard Roblox globals like game, workspace, Instance, etc.

Example

local renv = getrenv()

-- Access game globals
print(renv.game)      -- Same as game
print(renv.workspace) -- Same as workspace
print(renv.Instance)  -- Same as Instance

Finding Game Globals

-- List all globals in the game environment
local renv = getrenv()
for name, value in pairs(renv) do
    print(name, type(value))
end

Difference from getgenv

getrenv()getgenv()
Game's environmentVolt's environment
Contains Roblox globalsContains volt globals
Read-only access recommendedCan freely modify

Checking for Global Modifications

-- Check if game modified a global
local renv = getrenv()
if renv.print ~= print then
    warn("print function was modified!")
end
  • getgenv - Get volt's environment
  • getsenv - Get a script's environment

On this page