Meorawr31439 (talk | contribs) (Initial docs for getfenv and the __environment key) Tag: WoW API docs |
Meorawr31439 (talk | contribs) m (key => field) Tag: WoW API docs |
||
Line 10: | Line 10: | ||
==Details== |
==Details== |
||
− | * If the environment of a function has a metatable applied with the <code>__environment</code> |
+ | * If the environment of a function has a metatable applied with the <code>__environment</code> field set, this function will instead return the value assigned to that key. |
==Patch changes== |
==Patch changes== |
Revision as of 17:15, 29 July 2021
Returns the current environment in use by the function.
env = getfenv(f)
Arguments
- f
- number - A function to retrieve the environment of, or a numeric level of a function on the call stack starting from 1.
Returns
- env
- table - The environment assigned to the function.
Details
- If the environment of a function has a metatable applied with the
__environment
field set, this function will instead return the value assigned to that key.
Patch changes
- Patch 1.1.0 (2004-11-07): Added.