ReferenceEnvironment

setuntouched

Sets the environment’s Luau safe-environment flag.

Syntax

setuntouched(env: table, untouched: boolean) -> ()

Also available as

set_un_touched

Parameters

ParameterTypeDescription
envtableEnvironment table.
untouchedbooleanNew safe-environment flag.

Description

Marking an environment untouched tells the VM it can trust optimized builtin imports. Do not set it to true after replacing builtins unless the environment satisfies those assumptions; optimized and ordinary lookups may otherwise disagree. This does not freeze the table.

Example

local env = getfenv()
setuntouched(env, false)
print(isuntouched(env))

These are Game executor contracts. Check build requirements and session lifetimes before using them.