Returns the environment for a function (or the global environment). If the environment has a
__environment metatable, that value is returned instead.
See also Lua library functions.
f- A function (
stackLevel- Level of a function in the calling stack (
env- Table containing all variables in the function's environment, or the global environment if
stackLevelis omitted (