FANDOM


Returns in which environment (i.e. the function code its executional context) a given function is active.

_env = getfenv ([func])

Parameters Edit

Arguments Edit

func
function|number - func can be a Lua 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 func is 0, getfenv returns the global environment. The default for func is 1.

Returns Edit

_env
table - The environment in which the function is operating.

Example Edit

local myEnv = getfenv(myFunc);

Notes Edit

Related Functions Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.