Yuari
Documentation
Docs/Debug/debug.getsafeenv

debug.getsafeenv

Returns whether a function, table or thread has a safe environment.

Syntax

debug.getsafeenv(target?: any) -> boolean

Parameters

ParameterTypeDescription
target?anyThe function or object being targeted.

Returns

TypeDescription
booleanWhether a function, table or thread has a safe environment

Description

debug.getsafeenv is part of the Debug library. The debug library exposes the internals of the active Luau state, including protos, constants, upvalues and stack frames.

The call is read-only: it resolves the current value when invoked and does not change the underlying state.

The aliases isuntouched(target?), getsafeenv(target?) resolve to the same implementation.

Example

print(debug.getsafeenv(function() end))

Notes

  • Aliases: isuntouched(target?), getsafeenv(target?).
  • Writing protos, constants or upvalues can corrupt a running function; test changes carefully.