Type Function
Library (globals)
Return value (varies)
Revision 2017.3077
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.


getfenv( [f] )
f (optional)

Function or Number. Specifies the function at that stack level.