Type Function Library (globals) Return value (varies) Revision Release 2022.3683 Keywords getfenv, setfenv, environment, global See also setfenv()
Returns the current environment in use by a specified Function. The first argument can be a Function or a Number that specifies the function at that stack level: level 1 is the function calling getfenv(). If the given function is not a Lua function, or if f is 0, getfenv() returns the global environment. The default for f is 1.