AcediaDocumentation

getfenv

Reads the environment of a function or a stack level.

Reading an environment clears its safe-environment optimization flag. Executor C functions report the executor script environment; engine C closures can report their own environment.

getfenv(subject: function | number?): table

Parameters

ParameterTypeDescription
subjectfunction | number?Function or stack level; defaults to 1. Level 0 returns the executor script environment.

Errors: A negative or unreachable level raises an error.

On this page