debug. getsafeenv Synchronous
debug.isuntouched
Read the safe-environment flag of a Luau environment table. It helps diagnose whether a function or coroutine is running with an environment marked safe.
Luau
debug.getsafeenv(target: EnvironmentTarget?) -> booleanParameters
| Parameter | Type | Description |
|---|---|---|
target | EnvironmentTarget? | Optional function, table, or thread whose environment should be checked. Omit for the current environment. |
Argument fields
Luau
EnvironmentTarget = Table | Function | thread | booleanReturns
booleantrue when the selected environment has its safe flag set.
Example
Luau
local environment = {}
print(debug.getsafeenv(environment))