Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone explain getfenv() and setfenv()?

Asked by
ked2000 15
10 years ago

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!

0
Anyone? ked2000 15 — 10y

1 answer

Log in to vote
0
Answered by
brianush1 235 Moderation Voter
10 years ago

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.

Ad

Answer this question