API setfenv

Modifies the environment associated with a function.
 f = setfenv(f, env)
==Arguments==
:;f: or - A function to modify the environment of, or a numeric level of a function on the call stack starting from 1.
:;env: - The environment to be assigned to the function.
==Returns==
:;f: - The function whose environment was modified.
==Details==
* This function will raise an error if the function to be modified has an existing environment whose metatable has an __environment field set.
* If this function is called insecurely and the modified function is a Lua function, the modified function will be irrevocably tainted. This will result in all future calls to the function tainting execution.
==Patch changes==