getgenv
Returns the shared executor environment.
Changes persist across executor chunks in the current game session. This table falls through to engine globals; _G and shared are separate shared tables.
Its metatable is locked, so getmetatable(getgenv()) returns the string "The metatable is locked" rather than the table.
The globals in it resolve through the environment of the closure that reads them, so setfenv sandboxes them like any other global: a closure given an empty environment sees them as nil.
getgenv(): tableExample
local env = getgenv()
env.sessionLabel = "example"
print(getgenv().sessionLabel)Example output
example