Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
(Initial docs for getfenv and the __environment key)
Tag: WoW API docs
 
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> key set, this function will instead return the value assigned to that key.
+
* 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