I don't understand how it works but I know that it can set and get the environment of a function. How can it be used?
Any help is greatly appreciated!
The environment of a function is anything that the function has access to. getfenv() gets a table with the contents of what the function is able to access, and setfenv(function, table) can remove or add things that the function can have access to.