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.

Syntax
Luau
debug.getsafeenv(target: EnvironmentTarget?) -> boolean

Parameters

Function parameters
ParameterTypeDescription
targetEnvironmentTarget?Optional function, table, or thread whose environment should be checked. Omit for the current environment.

Argument fields

EnvironmentTarget fields
Luau
EnvironmentTarget = Table | Function | thread | boolean

Returns

boolean

true when the selected environment has its safe flag set.

Example

Example
Luau
local environment = {}
print(debug.getsafeenv(environment))
Kawaii documentation