Difference between revisions of "Getfenv"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(One intermediate revision by the same user not shown) | |||
Line 5: | Line 5: | ||
=== Description === | === Description === | ||
Returns the current environment in use by the function. | Returns the current environment in use by the function. | ||
− | < | + | <syntaxhighlight lang="lua"> |
(table) = getfenv(f) | (table) = getfenv(f) | ||
− | </ | + | </syntaxhighlight> |
''f'' 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 f is 0, getfenv returns the global environment. The default for f is 1. | ''f'' 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 f is 0, getfenv returns the global environment. The default for f is 1. |
Latest revision as of 14:29, 13 July 2023
Available since: Gideros 2011.6
Class: (global)
Description
Returns the current environment in use by the function.
(table) = getfenv(f)
f 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 f is 0, getfenv returns the global environment. The default for f is 1.
Parameters
f: (varies) function or number(call stack level) optional
Return values
Returns (table) environment with all the defined values in environment scope