Sets the environment to be used by a function. If the environment has a __environment
metatable, this function will error.
See also Lua library functions.
Signature:
f
=
setfenv([f,]
t)
or
setfenv([stackLevel,]
t)
Arguments:
f
- A function (function
)stackLevel
- Level of a function in the calling stack, or 0 to set the global environment (number
)t
- A table (table
)
Returns:
f
- The input functionf
(function
)
This function is defined in the Lua standard libraries